【问题标题】:Run jupyter nbconvert with ipython使用 ipython 运行 jupyter nbconvert
【发布时间】:2018-06-13 09:26:23
【问题描述】:

上下文:

我正在尝试运行启动以下命令的 ruby​​ 脚本:

jupyter nbconvert --to html --execute filename.ipynb

我收到以下错误:

Executing notebook with kernel: python2
[NbConvertApp] ERROR | Error while converting 'filename.ipynb'

...

ImportErrorTraceback (most recent call last)
<ipython-input-1-9ae86a16defc> in <module>()
----> 1 get_ipython().magic(u'matplotlib inline')
      2 import matplotlib

...    

ImportError: No module named matplotlib
ImportError: No module named matplotlib

搜索:

经过一些谷歌研究,我发现这是因为脚本是使用python2而不是ipython执行的。

问题:

如何强制 jupyter nbconvert 使用 ipython ?

【问题讨论】:

  • 假设您在 unix 上工作,您可以执行以下命令:less `which jupyter` 并告诉第一行是什么?它应该类似于 #!/usr/local/opt/python3/bin/python3.6
  • #!/home/champb/anaconda3/bin/python

标签: python ipython jupyter


【解决方案1】:

这对我有用 jupyter nbconvert --to html --execute filename.ipynb --xecutePreprocessor.kernel_name=python3.

【讨论】:

    猜你喜欢
    • 2020-11-09
    • 1970-01-01
    • 1970-01-01
    • 2018-02-09
    • 2016-06-09
    • 2016-12-24
    • 2017-07-11
    • 1970-01-01
    • 2017-02-21
    相关资源
    最近更新 更多