pip ImportError: cannot import name main

Ubuntu,通过apt方式安装了pip:

# apt install python-pip

再更新下pip:

# pip install -U pip

Installing collected packages: pip
Found existing installation: pip 8.1.1
Not uninstalling pip at /usr/lib/python2.7/dist-packages, outside environment /usr
Successfully installed pip-18.0

看上去更新成功了,但结果是:

# pip --version

Traceback (most recent call last):
File “/usr/bin/pip”, line 9, in
from pip import main
ImportError: cannot import name main

此时你需要清空一下缓存:

# hash -r

再运行一下:

# pip --version

pip 18.0 from /usr/local/lib/python2.7/dist-packages/pip (python 2.7)

发表评论

电子邮件地址不会被公开。 必填项已用*标注

This site uses Akismet to reduce spam. Learn how your comment data is processed.