簡體   English   中英

Virtualenv shell錯誤

[英]Virtualenv shell errors

我剛剛在我的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安裝任何東西。

這里出了什么問題,我該如何解決? 互聯網似乎沒有很多裝卸工具的錯誤案例。 我覺得此刻相當困難!

非常感謝!

我也使用zsh並遇到了類似的問題。 我用這個解決了:

sudo pip install virtualenv virtualenvwrapper

我在我的Ubuntu 12.04中安裝了python-pip包。

根據您獲得的錯誤,您似乎遇到以下錯誤: 使用pip + virtualenv時安裝故障

使用-distribute開關時會創建此問題。 修復是(沒有使用--distribute重新運行virtualenv):

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

有相同的錯誤消息,升級setuptools解決了我的問題。

pip install --upgrade setuptools

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

升級到OSX Mavericks后我遇到了同樣的問題。 我通過全局安裝分發來修復它。

sudo pip install distribute

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM