使用Enthought Python Distribution启动IPython错误

时间:2014-01-20 07:18:29

标签: macos enthought

我拥有Enthought Python Distribution的学术许可,当我尝试运行ipython时,我遇到了一个奇怪的错误。以下是我看到的一些行为:

$ ipython
Traceback (most recent call last):
  File "/Library/Frameworks/EPD64.framework/Versions/Current/bin/ipython", line 8, in <module>
    from IPython import start_ipython
ImportError: cannot import name start_ipython

$ python
Enthought Python Distribution -- www.enthought.com
Version: 7.3-2 (64-bit)

Python 2.7.2 |EPD 7.3-2 (64-bit)| (default, Sep  7 2011, 16:31:15)
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin
Type "credits", "demo" or "enthought" for more information.
>>> import IPython
>>> IPython.start_ipython()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'start_ipython'
>>>

当我运行enpkg enstaller时,它更新了ipython,看起来一切正常。

$ sudo enpkg ipython
prefix: /Library/Frameworks/EPD64.framework/Versions/7.2
No update necessary, 'ipython' is up-to-date.
ipython-1.1.0-6.egg was installed on: Sun Jan 19 23:57:27 2014

$ which ipython
/Library/Frameworks/EPD64.framework/Versions/Current/bin/ipython

$ which python
/Library/Frameworks/EPD64.framework/Versions/Current/bin/python

我可以做些什么帮助或建议让ipython重新开始工作?

2 个答案:

答案 0 :(得分:1)

我的学术许可与Enthought Python Distribution相同。我按照回答中列出的步骤进行操作,现在可以确认一切正常。在Enthought知识库中没有提到这个解决方案。谢谢!

答案的一个补充:为了找到您需要从系统中删除的目录。 。

$ python
import IPython
print IPython

答案 1 :(得分:0)

好好看了一下后,我发现有人说另一次安装ipython可能会导致问题。 enpkg正在尝试安装ipython 1.1.0,但我仍然有0.13.1左右。所以我通过以下方式删除了它:

$ sudo rm -rf /Library/Frameworks/EPD64.framework/Versions/7.2/lib/python2.7/site-packages/ipython-0.13.1-py2.7.egg

然后它载有关于kernmagic的错误,所以:

$ sudo enpkg kernmagic

它以某种方式重新安装了ipython 1.0

$ ipython
Python 2.7.2 |EPD 7.3-2 (64-bit)| (default, Sep  7 2011, 16:31:15)
Type "copyright", "credits" or "license" for more information.

IPython 1.0.0 -- An enhanced Interactive Python.

因此,只需重新尝试enpkg命令即可安装最新版本。

$ sudo enpkg ipython
prefix: /Library/Frameworks/EPD64.framework/Versions/7.2
ipython-1.0.0-2.egg                                                [removing]
 12.84 MB [.................................................................]
Jinja2-2.6-2.egg                                                   [removing]
  1.58 MB [.................................................................]
tornado-2.2-1.egg                                                  [removing]
  1.42 MB [.................................................................]
tornado-3.1.1-1.egg                                              [installing]
  2.16 MB [.................................................................]
Jinja2-2.7.1-1.egg                                               [installing]
  1.62 MB [.................................................................]
ipython-1.1.0-6.egg                                              [installing]
 12.92 MB [.................................................................]

$ ipython
Python 2.7.2 |EPD 7.3-2 (64-bit)| (default, Sep  7 2011, 16:31:15)
Type "copyright", "credits" or "license" for more information.

IPython 1.1.0 -- An enhanced Interactive Python.

现在它运行没有错误。所以,希望这有助于其他任何人遇到这些问题。