安装ipython失败,运行全新安装的iPython时出错

I am using virtualenvwrapper so anybody can reproduce it easily, but this happens as well using pip directly on my system.

After installing iPython with pip, I wont be able to run it (note I'm using the Python 2 interpreter, although the same exact thing will happen if I use Python 3):

$ mkvirtualenv -p python2 test

$ pip install --upgrade pip # Just in case...

$ pip install ipython

$ ipython

Traceback (most recent call last):

File "/home/peque/.virtualenvs/test/bin/ipython", line 7, in

from IPython import start_ipython

File "/home/peque/.virtualenvs/test/lib/python2.7/site-packages/IPython/__init__.py", line 48, in

from .terminal.embed import embed

File "/home/peque/.virtualenvs/test/lib/python2.7/site-packages/IPython/terminal/embed.py", line 16, in

from IPython.core.interactiveshell import DummyMod

File "/home/peque/.virtualenvs/test/lib/python2.7/site-packages/IPython/core/interactiveshell.py", line 31, in

from pickleshare import PickleShareDB

File "/home/peque/.virtualenvs/test/lib/python2.7/site-packages/pickleshare.py", line 41, in

from path import path as Path

ImportError: cannot import name path

Now, the packages I have installed after this simple steps are:

$ pip freeze

decorator==4.0.2

ipython==4.0.0

ipython-genutils==0.1.0

path.py==8.0

pexpect==3.3

pickleshare==0.5

simplegeneric==0.8.1

traitlets==4.0.0

Why am I getting this error? Is there any way to avoid it while still using iPython version 4?

解决方案

Quick fix

Just downgrade package:

pip install -I path.py==7.7.1

Explanation

There is a commit (62ccb76) made a couple of hours ago that removes the path alias and bumps path.py version to 0.8. Apparently, in order to fix Issue #102:

Removed path.path. Clients must now refer to the canonical name, path.Path as introduced in 6.2.

However, pickleshare has not been updated and continues to use the old alias.

The problem has already been reported, and hope it will be fixed soon. I created a pull request in case it helps.

Update

The pull request has already been merged and version 8.1 of path.py adds the path alias again (a warning will be generated instead for now). So users should not hit this problem now.

Updating the package to version 8.1 should fix the problem as well now:

pip install -I path.py==8.1

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值