简体   繁体   English

ImportError:无法导入名称start_ipython

[英]ImportError: cannot import name start_ipython

I have extracted ipython-1.1.0.tar.gz in /usr/lib/ipython-1.1.0 and have run the following commands to finish the build and installation: 我在/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

I am using Python 2.6 and is installed under /usr/bin/python2.6 and have my additional packages under /usr/lib/python2.6/site-packages/ 我正在使用Python 2.6并安装在/usr/bin/python2.6下,并在/usr/lib/python2.6/site-packages/下有我的附加软件包

Now, when I am trying to start ipython notebook from shell command, I am getting the following ImportError message: 现在,当我尝试从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

When I tried to start the IPython instance as mentioned in README.rst file, I got the following message: 当我尝试启动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

I tried easy_install and pip install 我试过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

But the ImportError problem still remains unresolved. 但是ImportError问题仍然没有得到解决。 This is not allowing to open the interactive Python. 这不允许打开交互式Python。

I found some solution in the below link, but not sure about it: 我在下面的链接中找到了一些解决方案,但不确定:

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

I just ran into this problem as well. 我也遇到了这个问题。 Are we sure the IPython API didn't change? 我们确定IPython API没有改变吗? I got something that looks right working with: 我得到了一些看起来正确的东西:

import IPython
IPython.Shell.start()

edit: ok, nvmind. 编辑:好的,nvmind。 There was also another program I installed at the same time that decided to change PYTHONPATH. 还有我同时安装的另一个程序决定改变PYTHONPATH。

This worked for me: 这对我有用:

import IPython
IPython.start_ipython()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM