当前位置:  开发笔记 > 编程语言 > 正文

Virtualenv shell错误

如何解决《Virtualenvshell错误》经验,为你挑选了3个好方法。

我刚刚在我的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 "", line 1, in 
    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 "", line 1, in 

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安装任何东西.

这里出了什么问题,我该如何解决?互联网似乎没有很多装卸工具的错误案例.我觉得此刻相当困难!

非常感谢!



1> msampaio..:

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

sudo pip install virtualenv virtualenvwrapper

python-pip在Ubuntu 12.04中安装了软件包.



2> BigHandsome..:

基于您获得的错误,您似乎遇到以下错误:使用pip + virtualenv时安装故障.

使用-distribute开关时会创建此问题.修复是(没有使用--distribute重新运行virtualenv):

source bin/activate
wget http://python-distribute.org/distribute_setup.py
python distribute_setup.py



3> Mart Coul..:

有相同的错误消息,升级setuptools解决了我的问题.

pip install --upgrade setuptools

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

推荐阅读
pan2502851807
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有