16

我刚刚在我的 Mac 上安装了 virtualenv(使用 Python 2.7.2),并按照此处的指南进行操作:http: //virtualenvwrapper.readthedocs.org/en/latest/install.html

但是现在每次启动 shell 时都会出现以下错误:

stevedore.extension Could not load 'user_scripts': distribute
stevedore.extension distribute
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/stevedore/extension.py", line 62, in __init__
    invoke_kwds,
  File "/Library/Python/2.7/site-packages/stevedore/extension.py", line 74, in _load_one_plugin
    plugin = ep.load()
  File "/Library/Python/2.7/site-packages/setuptools-0.6c11-py2.7.egg/pkg_resources.py", line 1953, in load
    if require: self.require(env, installer)
  File "/Library/Python/2.7/site-packages/setuptools-0.6c11-py2.7.egg/pkg_resources.py", line 1966, in require
    working_set.resolve(self.dist.requires(self.extras),env,installer))
  File "/Library/Python/2.7/site-packages/setuptools-0.6c11-py2.7.egg/pkg_resources.py", line 565, in resolve
    raise DistributionNotFound(req)  # XXX put more info here
DistributionNotFound: distribute
stevedore.extension Could not load 'project': distribute
stevedore.extension distribute
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/stevedore/extension.py", line 62, in __init__
    invoke_kwds,
  File "/Library/Python/2.7/site-packages/stevedore/extension.py", line 74, in _load_one_plugin
    plugin = ep.load()
  File "/Library/Python/2.7/site-packages/setuptools-0.6c11-py2.7.egg/pkg_resources.py", line 1953, in load
    if require: self.require(env, installer)
  File "/Library/Python/2.7/site-packages/setuptools-0.6c11-py2.7.egg/pkg_resources.py", line 1966, in require
    working_set.resolve(self.dist.requires(self.extras),env,installer))
  File "/Library/Python/2.7/site-packages/setuptools-0.6c11-py2.7.egg/pkg_resources.py", line 565, in resolve
    raise DistributionNotFound(req)  # XXX put more info here
DistributionNotFound: distribute
stevedore.extension Could not load 'user_scripts': distribute
stevedore.extension distribute
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/stevedore/extension.py", line 62, in __init__
    invoke_kwds,
  File "/Library/Python/2.7/site-packages/stevedore/extension.py", line 74, in _load_one_plugin
    plugin = ep.load()
  File "/Library/Python/2.7/site-packages/setuptools-0.6c11-py2.7.egg/pkg_resources.py", line 1953, in load
    if require: self.require(env, installer)
  File "/Library/Python/2.7/site-packages/setuptools-0.6c11-py2.7.egg/pkg_resources.py", line 1966, in require
    working_set.resolve(self.dist.requires(self.extras),env,installer))
  File "/Library/Python/2.7/site-packages/setuptools-0.6c11-py2.7.egg/pkg_resources.py", line 565, in resolve
    raise DistributionNotFound(req)  # XXX put more info here
DistributionNotFound: distribute

我不知道它是否会影响这个问题,但我正在使用 ZSH。

我尝试通过 pip (sudo pip install stevedore) 安装 stevedore,但出现以下错误:

sudo sh setuptools-0.6c11-py2.7.egg
Processing setuptools-0.6c11-py2.7.egg
removing '/Library/Python/2.7/site-packages/setuptools-0.6c11-py2.7.egg' (and everything under it)
Copying setuptools-0.6c11-py2.7.egg to /Library/Python/2.7/site-packages
setuptools 0.6c11 is already the active version in easy-install.pth
Installing easy_install script to /usr/local/bin
Installing easy_install-2.7 script to /usr/local/bin

Installed /Library/Python/2.7/site-packages/setuptools-0.6c11-py2.7.egg
Processing dependencies for setuptools==0.6c11
Finished processing dependencies for setuptools==0.6c11
TXSLs-MacBook-Pro% sudo pip install stevedore --upgrade
Requirement already up-to-date: stevedore in /Library/Python/2.7/site-packages
Downloading/unpacking distribute (from stevedore)
  Running setup.py egg_info for package distribute

Installing collected packages: distribute
  Running setup.py install for distribute
    Before install bootstrap.
    Scanning installed packages
    Setuptools installation detected at /Library/Python/2.7/site-packages/setuptools-0.6c11-py2.7.egg
    Egg installation
    Patching...
    Renaming /Library/Python/2.7/site-packages/setuptools-0.6c11-py2.7.egg into /Library/Python/2.7/site-packages/setuptools-0.6c11-py2.7.egg.OLD.1348764450.4
    Patched done.
    Relaunching...
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
    NameError: name 'install' is not defined
    Complete output from command /usr/bin/python -c "import setuptools;__file__='/tmp/pip-build/distribute/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-FAPgYH-record/install-record.txt --single-version-externally-managed:
    Before install bootstrap.

Scanning installed packages

Setuptools installation detected at /Library/Python/2.7/site-packages/setuptools-0.6c11-py2.7.egg

Egg installation

Patching...

Renaming /Library/Python/2.7/site-packages/setuptools-0.6c11-py2.7.egg into /Library/Python/2.7/site-packages/setuptools-0.6c11-py2.7.egg.OLD.1348764450.4

Patched done.

Relaunching...

Traceback (most recent call last):

  File "<string>", line 1, in <module>

NameError: name 'install' is not defined

----------------------------------------
Command /usr/bin/python -c "import setuptools;__file__='/tmp/pip-build/distribute/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-FAPgYH-record/install-record.txt --single-version-externally-managed failed with error code 1 in /tmp/pip-build/distribute
Storing complete log in /Users/txsl/Library/Logs/pip.log

我手动安装了 setuptools,因为没有它我无法通过 pip 安装任何东西。

这里出了什么问题,我该如何解决?互联网上似乎没有很多与装卸工人有关的错误案例。我现在感觉有点卡住了!

非常感谢!

4

4 回答 4

20

我也使用 zsh 并且遇到了类似的问题。我解决了这个问题:

sudo pip install virtualenv virtualenvwrapper

python-pip我的Ubuntu 12.04 中安装了该软件包。

于 2012-12-04T12:31:08.100 回答
17

根据您收到的错误,您似乎遇到以下错误:install glitch when using pip + virtualenv

使用 -distribute 开关时会产生此问题。修复方法是(无需使用 --distribute 重新运行 virtualenv):

source bin/activate
wget http://python-distribute.org/distribute_setup.py
python distribute_setup.py
于 2012-09-27T17:16:15.003 回答
7

有相同的错误消息,升级 setuptools 为我解决了这个问题。

pip install --upgrade setuptools

我在这个线程中找到了信息:http: //blog.gmane.org/gmane.comp.python.virtualenv/month=20131001

于 2014-01-25T17:17:34.763 回答
4

升级到 OSX Mavericks 后我遇到了同样的问题。我通过全局安装分发来修复它。

sudo pip install distribute

我首先停用了我当前的 virtualenv。

于 2014-01-25T18:05:06.053 回答