OS X 10.8升级后Python点破 [英] Python pip broken after OS X 10.8 upgrade
问题描述
进行了Mac OS X 10.8(Mountain Lion)的升级,并在尝试调用$ pip
时出现以下错误:
Made the upgrade to Mac OS X 10.8 (Mountain Lion) and get now the following error when trying to call $ pip
:
Traceback (most recent call last):
File "/usr/local/bin/pip", line 5, in <module>
from pkg_resources import load_entry_point
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2603, in <module>
working_set.require(__requires__)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 666, in require
needed = self.resolve(parse_requirements(requirements))
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 565, in resolve
raise DistributionNotFound(req) # XXX put more info here
pkg_resources.DistributionNotFound: pip==1.1
更新:尝试通过再次执行安装过程来重新安装(使用 http: //www.pip-installer.org/zh-CN/latest/installing.html#using-the-installer 和easy_install
),但没有成功,出现了相同的错误.
Update: Tried to reinstall by doing the install procedure again (with http://www.pip-installer.org/en/latest/installing.html#using-the-installer and easy_install
), but didn't work, got the same error.
现在尝试以下操作:调用$ sudo pip
,以上错误消失.奇怪的是,在上述错误消息中找不到的目录指向/System/Library/...,而python安装是(new?),可以在/Library/Frameworks/..中找到:
Tried now the following: Calling $ sudo pip
and the above error disappears. Strange is, that the directories which could not befound in the above error message point to /System/Library/... while the python installation is (new ?) to find in /Library/Frameworks/..:
$ which python
/Library/Frameworks/Python.framework/Versions/Current/bin/python
有人知道如何摆脱sudo吗?
Any idea how to get rid of the sudo?
推荐答案
使用easy_install
将pip
更新到最新版本:
Use easy_install
to update your pip
to the latest version:
sudo easy_install -U pip
还要确保安装了最新的XCode
(版本4.4)和Command Line Tools
.
Also make sure you have the lastest XCode
installed (ver 4.4) with Command Line Tools
.
这篇关于OS X 10.8升级后Python点破的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!