virtualenv失败setuptools安装错误代码1

时间:2017-01-24 18:06:19

标签: python-2.7 virtualenv setuptools

我整天都在互联网上查看涉及带有错误代码1和其他信息的virtualenv的各种问题,而且似乎没有一个完全符合我的情况,而且我不太了解virtualenv有任何想法去哪儿。我为文本的墙壁道歉,但我希望有人能够理解那里的某些东西。

我的环境:

OS: Red Hat Enterprise Linux Server release 6.1 (Santiago)
Global Python: /usr/local/bin/python (Python 2.6.6)
Local Python: /install/testuser/python7/bin/python (Python 2.7.1)
Virtulenv: /install/testuser/python7/bin/virtualenv (1.5.2)
User: testuser
Home: /install/users/testuser (i.e. not the working directory)

我的过程远远:

wget http://www.python.org/ftp/python/2.7.1/Python-2.7.1.tgz
tar -zxvf Python-2.7.1.tgz
cd Python-2.7.1
./configure --prefix=/install/testuser/python7
make
make install
cd /install/testuser/tmp
wget http://pypi.python.org/packages/source/v/virtualenv/virtualenv-1.5.2.tar.gz#md5=fbcefbd8520bb64bc24a560c6019a73c
tar -zxvf virtualenv-1.5.2.tar.gz
cd virtualenv-1.5.2/
/install/testuser/python7/bin/python setup.py install
mkdir /install/testuser/virtualenvs
cd /install/testuser/virtualenvs

我的问题:

testlax08> /install/testuser/python7/bin/virtualenv testrun -v --python=/install/testuser/python7/bin/python2.7
Running virtualenv with interpreter /install/testuser/python7/bin/python2.7
Creating testrun/lib/python2.7
Symlinking Python bootstrap modules
Symlinking testrun/lib/python2.7/lib-dynload
Symlinking testrun/lib/python2.7/config
Symlinking testrun/lib/python2.7/os.py
Ignoring built-in bootstrap module: posix
Symlinking testrun/lib/python2.7/posixpath.py
Cannot import bootstrap module: nt
Symlinking testrun/lib/python2.7/ntpath.py
Symlinking testrun/lib/python2.7/genericpath.py
Symlinking testrun/lib/python2.7/fnmatch.py
Symlinking testrun/lib/python2.7/locale.py
Symlinking testrun/lib/python2.7/encodings
Symlinking testrun/lib/python2.7/codecs.py
Symlinking testrun/lib/python2.7/stat.py
Symlinking testrun/lib/python2.7/UserDict.py
Symlinking testrun/lib/python2.7/copy_reg.py
Symlinking testrun/lib/python2.7/types.py
Symlinking testrun/lib/python2.7/re.py
Symlinking testrun/lib/python2.7/sre.py
Symlinking testrun/lib/python2.7/sre_parse.py
Symlinking testrun/lib/python2.7/sre_constants.py
Symlinking testrun/lib/python2.7/sre_compile.py
Symlinking testrun/lib/python2.7/warnings.py
Symlinking testrun/lib/python2.7/linecache.py
Symlinking testrun/lib/python2.7/_abcoll.py
Symlinking testrun/lib/python2.7/abc.py
Symlinking testrun/lib/python2.7/_weakrefset.py
Creating testrun/lib/python2.7/site-packages
Writing testrun/lib/python2.7/site.py
Writing testrun/lib/python2.7/orig-prefix.txt
Creating parent directories for testrun/include
Symlinking testrun/include/python2.7
Creating testrun/bin
New python executable in testrun/bin/python2.7
Changed mode of testrun/bin/python2.7 to 0755
Also creating executable in testrun/bin/python
Changed mode of testrun/bin/python to 0755
Testing executable with testrun/bin/python2.7 -c "import sys; print sys.prefix"
Got sys.prefix result: '/local/install/testuser/virtualenvs/testrun'
Creating testrun/lib/python2.7/distutils
Writing testrun/lib/python2.7/distutils/__init__.py
Writing testrun/lib/python2.7/distutils/distutils.cfg
No setuptools egg found; downloading
Installing setuptools...
Downloading http://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11-py2.7.egg
Searching for setuptools
Downloading https://pypi.python.org/packages/e3/6b/bb793ca610f364d1888b9bd7b83dccd0c27d779e4fd91a953ce8bae74996/setuptools-34.0.2.zip#md5=8e33d59407b6714e4e97274da538d08f
Running setuptools-34.0.2/setup.py -q bdist_egg --dist-dir /tmp/easy_install-L_ToWv/setuptools-34.0.2/egg-dist-tmp-Tr1OCR
/install/testuser/python7/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'src_root'
warnings.warn(msg)
Traceback (most recent call last):
<Cut for space, seriously, it is long, available on request>
RuntimeError: maximum recursion depth exceeded
----------------------------------------
...Installing setuptools...done.
Traceback (most recent call last):
File "/install/testuser/python7/lib/python2.7/site-packages/virtualenv.py", line 1649, in <module>
    main()
File "/install/testuser/python7/lib/python2.7/site-packages/virtualenv.py", line 558, in main
    prompt=options.prompt)
File "/install/testuser/python7/lib/python2.7/site-packages/virtualenv.py", line 654, in create_environment
    install_setuptools(py_executable, unzip=unzip_setuptools)
File "/install/testuser/python7/lib/python2.7/site-packages/virtualenv.py", line 384, in install_setuptools
    _install_req(py_executable, unzip)
File "/install/testuser/python7/lib/python2.7/site-packages/virtualenv.py", line 360, in _install_req 
    cwd=cwd)
File "/install/testuser/python7/lib/python2.7/site-packages/virtualenv.py", line 624, in call_subprocess
    % (cmd_desc, proc.returncode))
OSError: Command /local/install/testuser/virtual...on2.7 -c "#!python
\"\"\"Bootstrap setuptoo...




" --always-copy -U setuptools failed with error code 1

我的问题:

有人知道我遇到的问题以及我如何纠正它?限制是我必须使用Python 2.7,并且原始的Python 2.6.6不会受到干扰。

编辑:

我排除了一些因素。

我尝试安装多个版本的setuptools,但没有做任何事情。我设法单独安装了一个失败的setuptools版本,所以它看起来不像是一个setuptools问题。

我也不认为它与Python版本有关,尽管我对此不太确定。 pip似乎在Python 2.7.1中正确安装了setuptools,但还有其他问题促使我升级。但是不能确定。

1 个答案:

答案 0 :(得分:0)

仍然没有解决方案

我仍然不知道这个问题,但我找到了一个解决方法。更少的解决方法,我只是尝试以不同的方式安装并且它有效。

解决方法

首先,我安装了Python 2.7.13而不是Python 2.7.1,以便我可以支持pip。然后我安装了pip。默认情况下,pip会安装setuptools,因此当我设置virtualenv时,它并不需要,并且它运行正常。因此,对我的环境的唯一更改是Python版本,仍然存储在同一位置:Local Python: /install/testuser/python7/bin/python (Python 2.7.13)

我现在使用的流程包括安装pip:

wget http://www.python.org/ftp/python/2.7.13/Python-2.7.13.tgz
tar -zxvf Python-2.7.13.tgz
cd Python-2.7.13
./configure --prefix=/install/testuser/python7
make
make install
cd /install/testuser/tmp
wget --no-check-certificate https://bootstrap.pypa.io/get-pip.py
/install/testuser/python7/bin/python get-pip.py
wget http://pypi.python.org/packages/source/v/virtualenv/virtualenv-1.5.2.tar.gz#md5=fbcefbd8520bb64bc24a560c6019a73c
tar -zxvf virtualenv-1.5.2.tar.gz
cd virtualenv-1.5.2/
/install/testuser/python7/bin/python setup.py install
mkdir /install/testuser/virtualenvs
cd /install/testuser/virtualenvs

我会选择这个作为答案,但如果您知道/找到解决确切问题的更好解决方案,请随时发布。