virtualenv 无法安装 setuptools 安装错误代码 1

virtualenv fails setuptools install error code 1

整天上网查各种关于virtualenv的问题,error code 1等信息,好像none和我的情况很吻合,不懂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,但还有其他问题促使我升级。虽然永远无法确定。

仍然没有解决方案

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

解决方法

首先,我安装了 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

我会选择这个作为答案,但如果您know/find对确切问题有更好的解决方案,请随时post。