简体   繁体   English

在升级到OS X Mavericks之后破坏了easy_install和pip

[英]broken easy_install and pip after upgrading to OS X Mavericks

Upgraded to OS X 10.9 Mavericks and installed XCode, Command Line Tools, XQuartz, etc. Trying to run a pip install now, but it says that the distribution is not found: 升级到OS X 10.9 Mavericks并安装了XCode,命令行工具,XQuartz等。现在尝试运行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.4.1

So I tried to install pip with an easy_install. 所以我尝试用easy_install安装pip。 Turns out that's borked too: 事实证明,这也是愚蠢的:

Traceback (most recent call last):
  File "/usr/local/bin/easy_install", 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 2607, in <module>
parse_requirements(__requires__), Environment()
  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: setuptools==1.1.6

So some of the other threads say to reinstall setuptools with a sudo python ez_setup.py. 所以其他一些线程说要用sudo python ez_setup.py重新安装setuptools。 It seems to work fine: 它似乎工作正常:

Installed /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/setuptools-1.1.6-py2.7.egg
Processing dependencies for setuptools==1.1.6
Finished processing dependencies for setuptools==1.1.6

But when running the easy_install pip, the same pkg_resources.DistributionNotFound: setuptools==1.1.6 error occurs. 但是在运行easy_install pip时,会发生相同的pkg_resources.DistributionNotFound:setuptools == 1.1.6错误。 Anyone else have this problem? 其他人有这个问题吗? Any ideas how to fix this? 任何想法如何解决这一问题?

  1. Install easy_install : 安装easy_install

    Download ez_setup.py module from https://pypi.python.org/pypi/setuptools https://pypi.python.org/pypi/setuptools下载ez_setup.py模块

     $ cd path/to/ez_setup.py $ python ez_setup.py 
  2. Install pip : 安装pip

     $ sudo easy_install pip 

试试sudo python -m easy_install pip

I ran into a similar problem with git-review . 我用git-review遇到了类似的问题。

$ git review -s
Traceback (most recent call last):
  File "/usr/local/bin/git-review", line 11, in <module>
    sys.exit(main())
  File "/Library/Python/2.7/site-packages/git_review/cmd.py", line 1132, in main
    (os.path.split(sys.argv[0])[-1], get_version()))
  File "/Library/Python/2.7/site-packages/git_review/cmd.py", line 180, in get_version
    provider = pkg_resources.get_provider(requirement)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 197, in get_provider
    return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
  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: git-review

The git-review team said it was a bug with pkg_resources that could be fixed with git-review团队表示这是一个可以修复pkg_resources的错误

sudo pip install --upgrade setuptools

This worked fine for me. 这对我来说很好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM