【问题标题】:How to install Plotly for Python 3 Jupyter Notebook?如何为 Python 3 Jupyter Notebook 安装 Plotly?
【发布时间】:2019-01-22 21:38:31
【问题描述】:

我是一个初学者,我在安装 plotly 以在我的 Jupyter Notebook 中使用它时遇到问题。我已经安装了 Python 3 版本。如果这很重要,我也在使用 Mac。 我在终端中尝试了各种命令,但都没有奏效。

这是我在 Jupyter Notebook 中的命令:

from plotly import __version__
from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot

print(__version__) # requires version >= 1.9.0

这是我得到的错误:

ModuleNotFoundError: 没有名为“plotly”的模块

非常感谢您的帮助!提前致谢。 绝望的初学者

【问题讨论】:

标签: python plotly


【解决方案1】:

【讨论】:

    【解决方案2】:

    我现在已经解决了这个问题。我刚刚打开了一个新终端并确保我编写了命令

    pip install cufflinks
    

    直接在第二行之后。

    同样适用于

    pip install plotly
    

    【讨论】:

    • 太好了,我把文件下载到本地驱动器,然后从那里安装了pip
    【解决方案3】:

    官方documentation page说:

    要在经典 Jupyter Notebook 中使用,请使用 pip 安装 notebookipywidgets 软件包...

    $ pip install "notebook>=5.3" "ipywidgets>=7.2"
    

    或康达。

    $ conda install "notebook>=5.3" "ipywidgets>=7.2"
    

    这些包包含运行 Jupyter 笔记本所需的一切...

    $ jupyter notebook
    

    使用笔记本渲染器内嵌显示图形...

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-01-13
      • 1970-01-01
      • 2021-04-20
      • 2017-12-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多