ImportError:无法导入名称start_ipython

时间:2013-10-09 02:49:04

标签: python python-2.7 ipython ipython-notebook

我在/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

2 个答案:

答案 0 :(得分:0)

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

import IPython
IPython.Shell.start()

编辑: 好的,nvmind。还有我同时安装的另一个程序决定改变PYTHONPATH。

答案 1 :(得分:0)

这对我有用:

import IPython
IPython.start_ipython()