安装virtualenvwrapper遇到 “Command python setup.py egg_info failed with error code 1” error

安装virtualenvwrapper过程中遇到error。

执行命令:

sudo pip install virtualenvwrapper

遇到如下问题:

Downloading/unpacking virtualenvwrapper
  Downloading virtualenvwrapper-4.8.2.tar.gz (91kB): 91kB downloaded
  Running setup.py egg_info for package virtualenvwrapper
    Couldn't find index page for 'pbr' (maybe misspelled?)
    No local packages or download links found for pbr
    Traceback (most recent call last):
      File "<string>", line 16, in <module>
      File "/tmp/pip-build-root/virtualenvwrapper/setup.py", line 7, in <module>
        pbr=True,
      File "/usr/local/python2.7/lib/python2.7/distutils/core.py", line 111, in setup
        _setup_distribution = dist = klass(attrs)
      File "/usr/local/python2.7/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/setuptools/dist.py", line 260, in __init__
      File "/usr/local/python2.7/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/setuptools/dist.py", line 284, in fetch_build_eggs
      File "/usr/local/python2.7/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/pkg_resources.py", line 563, in resolve
      File "/usr/local/python2.7/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/pkg_resources.py", line 799, in best_match
      File "/usr/local/python2.7/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/pkg_resources.py", line 811, in obtain
      File "/usr/local/python2.7/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/setuptools/dist.py", line 327, in fetch_build_egg
      File "/usr/local/python2.7/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/setuptools/command/easy_install.py", line 434, in easy_install
      File "/usr/local/python2.7/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/setuptools/package_index.py", line 475, in fetch_distribution
    AttributeError: 'NoneType' object has no attribute 'clone'
    Complete output from command python setup.py egg_info:
    Couldn't find index page for 'pbr' (maybe misspelled?)

No local packages or download links found for pbr

Traceback (most recent call last):

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

  File "/tmp/pip-build-root/virtualenvwrapper/setup.py", line 7, in <module>

    pbr=True,

  File "/usr/local/python2.7/lib/python2.7/distutils/core.py", line 111, in setup

    _setup_distribution = dist = klass(attrs)

  File "/usr/local/python2.7/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/setuptools/dist.py", line 260, in __init__

  File "/usr/local/python2.7/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/setuptools/dist.py", line 284, in fetch_build_eggs

  File "/usr/local/python2.7/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/pkg_resources.py", line 563, in resolve

  File "/usr/local/python2.7/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/pkg_resources.py", line 799, in best_match

  File "/usr/local/python2.7/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/pkg_resources.py", line 811, in obtain

  File "/usr/local/python2.7/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/setuptools/dist.py", line 327, in fetch_build_egg

  File "/usr/local/python2.7/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/setuptools/command/easy_install.py", line 434, in easy_install

  File "/usr/local/python2.7/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/setuptools/package_index.py", line 475, in fetch_distribution

AttributeError: 'NoneType' object has no attribute 'clone'

----------------------------------------
Command python setup.py egg_info failed with error code 1 in /tmp/pip-build-root/virtualenvwrapper
Storing complete log in /root/.pip/pip.log

解决方案:

pip install --upgrade setuptools

再执行:

sudo pip install virtualenvwrapper

返回结果:

Downloading/unpacking virtualenvwrapper
  Running setup.py egg_info for package virtualenvwrapper
    [pbr] Processing SOURCES.txt
    warning: no previously-included files found matching '.gitignore'
    warning: no previously-included files found matching '.gitreview'
    warning: no previously-included files matching '*.pyc' found anywhere in distribution
    warning: no files found matching '*.html' under directory 'docs'
    warning: no files found matching '*.css' under directory 'docs'
    warning: no files found matching '*.js' under directory 'docs'
    warning: no files found matching '*.png' under directory 'docs'
Requirement already satisfied (use --upgrade to upgrade): virtualenv in /usr/local/python2.7/lib/python2.7/site-packages (from virtualenvwrapper)
Downloading/unpacking virtualenv-clone (from virtualenvwrapper)
  Downloading virtualenv-clone-0.3.0.tar.gz
  Running setup.py egg_info for package virtualenv-clone
Downloading/unpacking stevedore (from virtualenvwrapper)
  Downloading stevedore-1.28.0.tar.gz (504kB): 504kB downloaded
  Running setup.py egg_info for package stevedore
    [pbr] Processing SOURCES.txt
    warning: no previously-included files found matching '.gitignore'
    warning: no previously-included files found matching '.gitreview'
    warning: no previously-included files matching '*.pyc' found anywhere in distribution
    warning: no files found matching '*.rst' under directory 'docs'
    warning: no files found matching '*.py' under directory 'docs'
    warning: no files found matching '*.html' under directory 'docs'
    warning: no files found matching '*.css' under directory 'docs'
    warning: no files found matching '*.js' under directory 'docs'
    warning: no files found matching '*.png' under directory 'docs'
    warning: no files found matching '*.txt' under directory 'docs'
    warning: no files found matching '*.jpg' under directory 'docs'
    warning: no files found matching '*.py' under directory 'tests'
Downloading/unpacking pbr!=2.1.0,>=2.0.0 (from stevedore->virtualenvwrapper)
  Downloading pbr-4.0.2.tar.gz (107kB): 107kB downloaded
  Running setup.py egg_info for package pbr
    /usr/local/python2.7/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'long_description_content_type'
      warnings.warn(msg)
    [pbr] Processing SOURCES.txt
    warning: no previously-included files found matching '.gitignore'
    warning: no previously-included files found matching '.gitreview'
    warning: no previously-included files matching '*.pyc' found anywhere in distribution
Downloading/unpacking six>=1.10.0 (from stevedore->virtualenvwrapper)
  Downloading six-1.11.0.tar.gz
  Running setup.py egg_info for package six
    no previously-included directories found matching 'documentation/_build'
Installing collected packages: virtualenvwrapper, virtualenv-clone, stevedore, pbr, six
  Running setup.py install for virtualenvwrapper
    [pbr] Generating AUTHORS
    [pbr] AUTHORS complete (0.0s)
    [pbr] Reusing existing SOURCES.txt
    changing mode of build/scripts-2.7/virtualenvwrapper.sh from 644 to 755
    changing mode of build/scripts-2.7/virtualenvwrapper_lazy.sh from 644 to 755
    Skipping installation of /usr/local/python2.7/lib/python2.7/site-packages/virtualenvwrapper/__init__.py (namespace package)
    Installing /usr/local/python2.7/lib/python2.7/site-packages/virtualenvwrapper-4.8.2-py2.7-nspkg.pth
    changing mode of /usr/local/python2.7/bin/virtualenvwrapper_lazy.sh to 755
    changing mode of /usr/local/python2.7/bin/virtualenvwrapper.sh to 755
  Could not find .egg-info directory in install record for virtualenvwrapper
  Running setup.py install for virtualenv-clone
    Installing virtualenv-clone script to /usr/local/python2.7/bin
  Could not find .egg-info directory in install record for virtualenv-clone (from virtualenvwrapper)
  Running setup.py install for stevedore
    [pbr] Generating AUTHORS
    [pbr] AUTHORS complete (0.0s)
    [pbr] Reusing existing SOURCES.txt
  Could not find .egg-info directory in install record for stevedore (from virtualenvwrapper)
  Running setup.py install for pbr
    /usr/local/python2.7/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'long_description_content_type'
      warnings.warn(msg)
    [pbr] Generating AUTHORS
    [pbr] AUTHORS complete (0.0s)
    [pbr] Reusing existing SOURCES.txt
    Installing pbr script to /usr/local/python2.7/bin
  Could not find .egg-info directory in install record for pbr!=2.1.0,>=2.0.0 (from stevedore->virtualenvwrapper)
  Running setup.py install for six
    no previously-included directories found matching 'documentation/_build'
  Could not find .egg-info directory in install record for six>=1.10.0 (from stevedore->virtualenvwrapper)
Successfully installed virtualenvwrapper virtualenv-clone stevedore pbr six
Cleaning up...

至此,成功安装!

参考链接:https://stackoverflow.com/questions/35991403/pip-install-returns-python-setup-py-egg-info-failed-with-error-code-1?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa

原文地址:https://www.cnblogs.com/hcy-fly/p/8991132.html