问题描述
以下代码在Jupyter实验室中不呈现:
The following code does not render in Jupyter lab:
%matplotlib widget
import plotly.express as px
import numpy as np
import pandas as pd
df = pd.DataFrame(np.random.randint(0,100,size=(5, 4)), columns=list('ABCD'))
px.bar(df, x='A', y='B')
我试图安装这里提到的所有依赖项和扩展 https://plot.ly/python/getting-started/#jupyterlab-support-python-35
I have tried to install all the dependencies and extensions mentioned in herehttps://plot.ly/python/getting-started/#jupyterlab-support-python-35
而且这里的步骤 https://github.com/matplotlib/jupyter-matplotlib
什么都没做
这是我的设置:
jupyter lab --version
1.0.2
python --version
Python 3.6.1 :: Continuum Analytics, Inc.
conda list jupyterlab
# packages in environment at C:\Users\***\Anaconda3:
#
# Name Version Build Channel
jupyterlab 1.0.2 py36hf63ae98_0
jupyterlab_launcher 0.13.1 py36_0
jupyterlab_server 1.0.0 py_0
conda list nodejs
# packages in environment at C:\Users\***\Anaconda3:
#
# Name Version Build Channel
nodejs 0.1.1 pypi_0 pypi
conda list plotly
# packages in environment at C:\Users\***\Anaconda3:
#
# Name Version Build Channel
plotly 4.1.0 pypi_0 pypi
plotly-express 0.4.1 pypi_0 pypi
jupyter-labextension list
JupyterLab v1.0.2
Known labextensions:
app dir: C:\Users\***\Anaconda3\share\jupyter\lab
@jupyter-widgets/jupyterlab-manager v1.0.2 enabled ok
@jupyterlab/git v0.8.0 enabled ok
@jupyterlab/plotly-extension v1.0.0 enabled ok
jupyter-matplotlib v0.4.2 enabled ok
jupyterlab-chart-editor v1.2.0 enabled ok
jupyterlab-plotly v1.1.0 enabled ok
plotlywidget v1.1.0 enabled ok
推荐答案
这些说明及更多内容现在在我们的官方故障排除指南!
these instructions and more are now in our official Troubleshooting Guide!
可能是以前安装的残余物或尝试进行安装导致了问题.我建议从全新安装开始或卸载所有Plotly模块(从pip和conda!)和与plotly相关的jlab扩展,然后按照此处的说明进行操作: https://plot.ly/python/getting-started/
It could be that remnants of previous installations or attempts at installation are causing issues. I recommend either starting with a clean install or uninstalling all Plotly modules (from both pip and conda!) and plotly-related jlab extensions, and then following the instructions here: https://plot.ly/python/getting-started/
卸载模块只需
conda uninstall plotly
pip uninstall plotly
然后根据上面链接的说明重新安装其中一个,但不能同时安装.
And then reinstalling with one or the other but not both, according to the instructions linked above.
卸载JupyterLab扩展的步骤是
Uninstalling JupyterLab extensions is performed with
jupyter labextension uninstall @jupyterlab/plotly-extension
jupyter labextension uninstall jupyterlab-plotly
jupyter labextension uninstall plotlywidget
这篇关于在Jupyter实验室中不进行情节快递的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!