最近运行yolk -U
我注意到pip
需要从1.2.1升级到1.4.1并尽职尽责地尝试升级
pip install --upgrade pip
虽然再次运行yolk -U
似乎确认升级成功(pip
不再列为过期),但这会生成错误消息
Downloading/unpacking pip from https://pypi.python.org/packages/source/p/pip/pip-1.4.1.tar.gz#md5=6afbb46aeb48abac658d4df742bff714
Downloading pip-1.4.1.tar.gz (445kB): 445kB downloaded
Running setup.py egg_info for package pip
warning: no files found matching '*.html' under directory 'docs'
warning: no previously-included files matching '*.rst' found under directory 'docs/_build'
no previously-included directories found matching 'docs/_build/_sources'
Installing collected packages: pip
Found existing installation: pip 1.2.1
Uninstalling pip:
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip-1.2.1-py2.7.egg/pip/basecommand.py", line 107, in main
File "/Library/Python/2.7/site-packages/pip-1.2.1-py2.7.egg/pip/commands/install.py", line 261, in run
File "/Library/Python/2.7/site-packages/pip-1.2.1-py2.7.egg/pip/req.py", line 1162, in install
File "/Library/Python/2.7/site-packages/pip-1.2.1-py2.7.egg/pip/req.py", line 495, in uninstall
File "/Library/Python/2.7/site-packages/pip-1.2.1-py2.7.egg/pip/req.py", line 1492, in remove
File "/Library/Python/2.7/site-packages/pip-1.2.1-py2.7.egg/pip/util.py", line 273, in renames
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 299, in move
os.unlink(src)
OSError: [Errno 13] Permission denied: '/usr/local/bin/pip'
在我后来尝试使用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>
line, p, specs = scan_list(VERSION,LINE_END,line,p,(1,2),"version spec")
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 666, in require
continue # try the next older version of project
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 565, in resolve
pkg_resources.DistributionNotFound: pip==1.2.1
我之前看到类似的问题have been reported,但我看到的任何建议都没有帮助解决这个问题。
我卡住了,无法维护我的Python安装。
我在/usr/bin/python
中使用OS 10.8.4,Python 2.7.2。
答案 0 :(得分:6)
根据这条线:
OSError: [Errno 13] Permission denied: '/usr/local/bin/pip'
这似乎是一个* nix权限问题,请尝试使用sudo启动升级:
sudo pip install --upgrade pip
另外,我建议使用此升级方法:http://www.pip-installer.org/en/latest/installing.html#install-or-upgrade-pip
tl; dr版本(感谢OP提供的信息;)):
1.从http://www.pip-installer.org/en/latest/installing.html#install-or-upgrade-pip
下载和laucnh get-pip.py2.如果您收到有关“无效命令'egg_info'”的错误,则需要使用pip install升级安装工具--upgrade setuptools或easy_install -U