升级pip后出现DistributionNotFound错误 [英] DistributionNotFound error after upgrading pip
问题描述
在阅读有关virtualenv的信息时此处,我意识到我没有1.3点以上的知识,所以我跑了pip install --upgrade pip
,现在当我运行pip --version
时,我得到以下信息:
In reading about virtualenv here I realized I didn't have pip 1.3+, so I ran pip install --upgrade pip
and now when I run pip --version
i get the following:
Traceback (most recent call last):
File "/usr/local/bin/pip", line 5, in <module>
from pkg_resources import load_entry_point
File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/distribute-0.6.34-py2.7.egg/pkg_resources.py", line 2807, in <module>
parse_requirements(__requires__), Environment()
File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/distribute-0.6.34-py2.7.egg/pkg_resources.py", line 594, in resolve
raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: pip==1.2.1
如果有帮助,或者完全相关,那么我的$PATH
看起来像这样:
If it helps, or is at all relevant, my $PATH
looks like this:
/usr/local/bin:/usr/local/share/python:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin
另外,which pip
给了我/usr/local/bin/pip
.
不确定如何处理该错误.谢谢.
Not sure what to do about the error. Thanks.
推荐答案
残酷的方式:
假设您在Mac上使用自制软件(因为我看到了/usr/local/Cellar),我建议
The brutal way:
Assuming you are using homebrew for Mac (because I see /usr/local/Cellar), I suggest to
- 删除(或备份)
/usr/local/lib/python2.7
和 -
brew rm python && brew install python
.
- remove (or backup)
/usr/local/lib/python2.7
, and brew rm python && brew install python
.
这肯定会与python一起安装pip 1.3.3.您的分配也将为0.6.35.
This will definitely install pip 1.3.3 alongside of python. Your distribute will also be 0.6.35.
从/usr/local/lib/python2.7/site-packages
中删除:
-
easy-install.pth
-
pip-1.2.1-py2.7.egg
或您拥有的其他pip版本. -
distribute-0.6.34-py2.7.egg
或其他版本
easy-install.pth
pip-1.2.1-py2.7.egg
or other versions of pip you have.distribute-0.6.34-py2.7.egg
or other versions
然后,brew rm python && brew install python
.这将使来自brew和已安装东西的所有其他绑定保持不变. Python,pip和distribution将被最新版本取代.
Then, brew rm python && brew install python
. This will leave all your other bindings from brew and installed stuff intact. Python, pip and distribute will be replaced with up-to-date versions.
请确保您在/Library/Python/2.7/site-packages
中没有分发或设置工具或pip.该目录已在所有python 2.7版本(从brew或从OS X发行)中重新使用,并且会干扰Homebrew已安装的pip/distribute.
Please check that you don't have a distribute or setuptools or pip located in /Library/Python/2.7/site-packages
. That dir is re-used by all python 2.7 versions (brewed or from OS X) and will interferre with the pip/distribute already installed by Homebrew.
这篇关于升级pip后出现DistributionNotFound错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!