我在使用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
我用Google搜索了最后一行,却一无所获。任何想法都表示赞赏。感谢。
答案 0 :(得分:8)
您可能需要安装nbconvert
:
pip install nbconvert
IPython建议使用pip(或conda)进行安装:
IPython依赖于许多其他Python包。使用像pip或conda这样的包管理器进行安装将确保安装必要的包。如果手动安装,则由您决定是否安装了依赖项。它们没有列在这里,因为它们可能会在不同版本之间发生变化,因此静态列表将不可避免地过时。
在old documentation和a bug report Pandoc被命名为依赖项和this bug report,将安装为:
sudo apt-get install pandoc