【发布时间】:2017-01-24 18:06:18
【问题描述】:
我整天都在网上查看涉及 virtualenv 的各种问题,错误代码为 1 和其他信息,似乎没有一个完全符合我的情况,而且我对 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 virtualenv setuptools