4

我在 /usr/lib/ipython-1.1.0 中提取了 ipython-1.1.0.tar.gz 并运行了以下命令来完成构建和安装:

root@my-laptop:/usr/lib/ipython-1.1.0# python setup.py build
root@my-laptop:/usr/lib/ipython-1.1.0# python setup.py install

我正在使用 Python 2.6 并安装在 /usr/bin/python2.6 下,并且在 /usr/lib/python2.6/site-packages/ 下有我的附加包

现在,当我尝试从 shell 命令启动 ipython notebook 时,我收到以下 ImportError 消息:

root@my-laptop:/usr/lib/ipython-1.1.0# ipython notebook
Traceback (most recent call last):
 File "/usr/local/bin/ipython", line 5, in <module>
  from IPython import start_ipython
ImportError: cannot import name start_ipython

当我尝试启动 README.rst 文件中提到的 IPython 实例时,我收到以下消息:

root@my-laptop:/usr/lib/ipython-1.1.0# python -m IPython
/usr/bin/python: IPython is a package and cannot be directly executed

我尝试了 easy_install 和 pip install

root@my-laptop:/usr/lib/ipython-1.1.0# easy_install ipython
Searching for ipython
Best match: ipython 1.1.0
Adding ipython 1.1.0 to easy-install.pth file

Using /usr/local/lib/python2.6/dist-packages
Processing dependencies for ipython
root@my-laptop:/usr/lib/ipython-1.1.0# pip install ipython
Requirement already satisfied: ipython in /usr/lib/pymodules/python2.6
Installing collected packages: ipython
Successfully installed ipython

但是 ImportError 问题仍然没有解决。这不允许打开交互式 Python。

我在下面的链接中找到了一些解决方案,但不确定:

https://trac.macports.org/ticket/40119
4

2 回答 2

0

这对我有用:

import IPython
IPython.start_ipython()
于 2013-12-11T20:21:59.403 回答
0

我也遇到了这个问题。我们确定 IPython API 没有改变吗?我得到了一些看起来不错的东西:

import IPython
IPython.Shell.start()

编辑:好的,nvmind。我同时安装了另一个程序,它决定更改 PYTHONPATH。

于 2013-12-02T20:06:42.550 回答