提问者:小点点

为什么我在尝试升级pip后收到一个分布式未找到错误?


运行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

我看到类似的问题以前也被报道过,但是我看到的建议都没有帮助解决这个问题。

我卡住了,无法维护我的Python安装。

我使用OS10.8.4,Python2.7.2在/usr/bin/python.


共1个答案

匿名用户

根据这一行:

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.Download和laucnhget-pip.pyhttp://www.pip-installer.org/en/latest/installing.html#install-or-upgrade-pip

2.如果您收到有关“无效命令'egg_info'”的错误,您需要使用pip install--update setuptools或easy_install-U升级安装工具