5

我在 Ubuntu 上,我使用的是 Python 2.7.6 和 Ipython 4.0.3。我正在尝试将 ipynb 文件转换为 pdf 文件。它给出了以下错误:

ipython nbconvert --to pdf mine.ipynb 
Traceback (most recent call last):
File "/usr/bin/ipython", line 6, in <module>
start_ipython()
File "/usr/local/lib/python2.7/dist-packages/IPython/__init__.py", line    119, in start_ipython
return launch_new_instance(argv=argv, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/traitlets/config    /application.py", line 588, in launch_instance
app.initialize(argv)
File "<decorator-gen-111>", line 2, in initialize
File "/usr/local/lib/python2.7/dist-packages/traitlets/config/application.py", line 74, in catch_config_error
return method(app, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/IPython/terminal/ipapp.py", line 305, in initialize
super(TerminalIPythonApp, self).initialize(argv)
File "<decorator-gen-7>", line 2, in initialize
File "/usr/local/lib/python2.7/dist-packages/traitlets/config/application.py", line 74, in catch_config_error
return method(app, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/IPython/core/application.py", line 386, in initialize
self.parse_command_line(argv)
File "/usr/local/lib/python2.7/dist-packages/IPython/terminal/ipapp.py", line 300, in parse_command_line
return super(TerminalIPythonApp, self).parse_command_line(argv)
File "<decorator-gen-4>", line 2, in parse_command_line
File "/usr/local/lib/python2.7/dist-packages/traitlets/config/application.py", line 74, in catch_config_error
return method(app, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/traitlets/config/application.py", line 485, in parse_command_line
return self.initialize_subcommand(subc, subargv)
File "<decorator-gen-3>", line 2, in initialize_subcommand
File "/usr/local/lib/python2.7/dist-packages/traitlets/config/application.py", line 74, in catch_config_error
return method(app, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/traitlets/config/application.py", line 416, in initialize_subcommand
subapp = import_item(subapp)
File "/usr/local/lib/python2.7/dist-packages/ipython_genutils/importstring.py", line 31, in import_item
module = __import__(package, fromlist=[obj])
ImportError: No module named nbconvert.nbconvertapp

我用谷歌搜索了最后一行,一无所获。任何想法都值得赞赏。谢谢。

4

1 回答 1

9

您可能必须安装nbconvert

pip install nbconvert

IPython 推荐使用 pip(或 conda)进行安装:

IPython 依赖于许多其他 Python 包。使用 pip 或 conda 等包管理器进行安装将确保安装必要的包。如果您手动安装,则由您决定是否安装了依赖项。它们没有在此处列出,因为它们可能会因版本而异,因此静态列表不可避免地会过时。

旧文档错误报告中, Pandoc被命名为依赖项,此错误报告被安装为:

sudo apt-get install pandoc
于 2016-01-20T17:21:35.520 回答