【问题标题】:Import module "ipython" in Jupyter notebook在 Jupyter 笔记本中导入模块“ipython”
【发布时间】:2017-03-10 10:44:20
【问题描述】:

有人可以帮我将 ipython 模块加载到 jupyter 笔记本中吗?

【问题讨论】:

    标签: widget ipython jupyter


    【解决方案1】:

    ipython 是 Jupyter 的依赖项,所以它已经安装了。

    您似乎正在尝试导入 ipython 小部件 (ipywidgets) 以在 Jupyter 中使用。为此,请在您的 shell(Jupyter 之外)中安装 ipywidgets:

    pip install ipywidgets
    jupyter nbextension enable --py widgetsnbextension
    

    然后导入小部件:

    import ipywidgets as widgets

    Read the docs to learn more about installing and using ipython widgets.

    【讨论】:

    • 谢谢,效果很好。但是,我面临其他软件包(例如 numpy)的问题。 jupyter nbextension enable --py numpynbextension 无法通过 Jupyter 进行访问。对此有什么想法:)?
    • 另外,我仍然无法运行代码:from Ipython.display import display display(text) 虽然您说 ipython 依赖项已经安装?
    • 在您的 conda 环境中尝试pip install numpy
    【解决方案2】:

    我认为部分问题是您的 import 语句中 IPython 包的大写:

    试试:import IPython.html.widgets

    我不知道这是否能让你得到你想要的一切,但这可能是你导入的问题。

    【讨论】:

      猜你喜欢
      • 2020-11-22
      • 2021-04-24
      • 1970-01-01
      • 1970-01-01
      • 2017-02-03
      • 1970-01-01
      • 2021-02-02
      • 2019-10-09
      • 2016-03-01
      相关资源
      最近更新 更多