plotly 4.1 没有情节

No plot from plotly 4.1

我一直在努力学习如何使用 plotly。我按照所有安装说明进行操作,但是当我 运行 渲染代码时,它只是显示为空白 space.

我正在使用 jupyterlab 在线,python 3.6 下面的代码来自这个link

! pip install jupyterlab==1.0 "ipywidgets==7.5"

# Avoid "JavaScript heap out of memory" errors during extension installation
# (OS X/Linux)
! export NODE_OPTIONS=--max-old-space-size=4096
# (Windows)
! set NODE_OPTIONS=--max-old-space-size=4096

# Jupyter widgets extension
! jupyter labextension install @jupyter-widgets/jupyterlab-manager@1.0 --no-build

# FigureWidget support
! jupyter labextension install plotlywidget@1.1.0 --no-build

# and jupyterlab renderer support
! jupyter labextension install jupyterlab-plotly@1.1.0 --no-build

# JupyterLab chart editor support (optional)
! jupyter labextension install jupyterlab-chart-editor@1.2 --no-build

# Build extensions (must be done to activate extensions since --no-build is used above)
! jupyter lab build

# Unset NODE_OPTIONS environment variable
# (OS X/Linux)
! unset NODE_OPTIONS
# (Windows)
! set NODE_OPTIONS=

扩展的安装似乎是成功的,因为当我检查可用的扩展时,出现的是:

但是,当我运行下面的代码时,它在单元格下面出现空白space:

import plotly.graph_objects as go
fig = go.Figure(data=go.Bar(y=[2, 3, 1]))
fig.show()

查看输出:

我尝试使用较低版本的 plotly ,但问题仍然存在。我也在 plotly 社区进行了研究并寻找答案,但没有成功。

希望大家帮我算一下。

你最好的选择是从一个干净的环境开始或卸载所有 Plotly 扩展和模块,然后按照 https://plot.ly/python/getting-started/

中的说明进行操作

不幸的是,旧版本或以前安装的残余可能会干扰新版本的安装。