如何在Ubuntu 15.10上正確安裝IPython?

如何在Ubuntu 15.10上正確安裝IPython?

我使用安裝了 IPython

sudo apt-get install ipython ipython-notebook

但是當我嘗試啟動它時,它抱怨找不到某些組件:

sudo ipython notebook
Traceback (most recent call last):
  File "/usr/bin/ipython", line 5, in <module>
    start_ipython()
  File "/usr/lib/python2.7/dist-packages/IPython/__init__.py", line 120, in start_ipython
    return launch_new_instance(argv=argv, **kwargs)
  File "/usr/lib/python2.7/dist-packages/IPython/config/application.py", line 564, in launch_instance
    app.initialize(argv)
  File "<decorator-gen-110>", line 2, in initialize
  File "/usr/lib/python2.7/dist-packages/IPython/config/application.py", line 92, in catch_config_error
    return method(app, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/IPython/terminal/ipapp.py", line 321, in initialize
    super(TerminalIPythonApp, self).initialize(argv)
  File "<decorator-gen-7>", line 2, in initialize
  File "/usr/lib/python2.7/dist-packages/IPython/config/application.py", line 92, in catch_config_error
    return method(app, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/IPython/core/application.py", line 381, in initialize
    self.parse_command_line(argv)
  File "/usr/lib/python2.7/dist-packages/IPython/terminal/ipapp.py", line 316, in parse_command_line
    return super(TerminalIPythonApp, self).parse_command_line(argv)
  File "<decorator-gen-4>", line 2, in parse_command_line
  File "/usr/lib/python2.7/dist-packages/IPython/config/application.py", line 92, in catch_config_error
    return method(app, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/IPython/config/application.py", line 475, in parse_command_line
    return self.initialize_subcommand(subc, subargv)
  File "<decorator-gen-3>", line 2, in initialize_subcommand
  File "/usr/lib/python2.7/dist-packages/IPython/config/application.py", line 92, in catch_config_error
    return method(app, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/IPython/config/application.py", line 406, in initialize_subcommand
    subapp = import_item(subapp)
  File "/usr/lib/python2.7/dist-packages/IPython/utils/importstring.py", line 42, in import_item
    module = __import__(package, fromlist=[obj])
  File "/usr/lib/python2.7/dist-packages/IPython/html/notebookapp.py", line 62, in <module>
    from tornado import httpserver
  File "/usr/local/lib/python2.7/dist-packages/tornado/httpserver.py", line 34, in <module>
    from tornado.http1connection import HTTP1ServerConnection, HTTP1ConnectionParameters
  File "/usr/local/lib/python2.7/dist-packages/tornado/http1connection.py", line 28, in <module>
    from tornado import gen
  File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 97, in <module>
    from singledispatch import singledispatch  # backport
ImportError: No module named singledispatch

版本資訊:

cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=15.10
DISTRIB_CODENAME=wily
DISTRIB_DESCRIPTION="Ubuntu 15.10"

答案1

安裝 ipython 筆記本:

sudo apt-get install ipython ipython-notebook

將自動python-tornado在系統範圍內安裝(這是強制性依賴項,請參閱http://packages.ubuntu.com/wily/ipython-notebook

您遇到singledispatch導入問題,因為您還在/usr/local/lib/python2.7/dist-packages/tornado.

嘗試使用以下命令刪除罪魁禍首版本:

sudo rm -rf /usr/local/lib/python2.7/dist-packages/tornado

相關內容