gpt4 book ai didi

python - 无法使用 virtualenv-2.7 创建 Virtualenv

转载 作者:太空宇宙 更新时间:2023-11-03 18:37:53 25 4
gpt4 key购买 nike

我在 Centos Linux 上有 2 个版本的 Python - Python2.6 和 Python2.7。我尝试使用我的 virtualenv-2.7 创建 virtualenv 并收到以下错误。

[root@linuxhost PythonProjects]# virtualenv-2.7 --distribute ENV
New python executable in ENV/bin/python2.7
Not overwriting existing python script ENV/bin/python (you must use ENV/bin/python2.7)
Installing setuptools, pip...
Complete output from command /home/prem/PythonProjects/ENV/bin/python2.7 -c "import sys, pip; pip...ll\"] + sys.argv[1:])" setuptools pip:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/local/lib/python2.7/site-packages/virtualenv-1.11-py2.7.egg/virtualenv_support/pip-1.5-py2.py3-none-any.whl/pip/__init__.py", line 9, in <module>
File "/usr/local/lib/python2.7/site-packages/virtualenv-1.11-py2.7.egg/virtualenv_support/pip-1.5-py2.py3-none-any.whl/pip/log.py", line 8, in <module>
File "/usr/local/lib/python2.7/site-packages/virtualenv-1.11-py2.7.egg/virtualenv_support/setuptools-2.0.2-py2.py3-none-any.whl/pkg_resources.py", line 2696, in <module>
File "/usr/local/lib/python2.7/site-packages/virtualenv-1.11-py2.7.egg/virtualenv_support/setuptools-2.0.2-py2.py3-none-any.whl/pkg_resources.py", line 429, in __init__
File "/usr/local/lib/python2.7/site-packages/virtualenv-1.11-py2.7.egg/virtualenv_support/setuptools-2.0.2-py2.py3-none-any.whl/pkg_resources.py", line 443, in add_entry
File "/usr/local/lib/python2.7/site-packages/virtualenv-1.11-py2.7.egg/virtualenv_support/setuptools-2.0.2-py2.py3-none-any.whl/pkg_resources.py", line 1722, in find_in_zip
File "/usr/local/lib/python2.7/site-packages/virtualenv-1.11-py2.7.egg/virtualenv_support/setuptools-2.0.2-py2.py3-none-any.whl/pkg_resources.py", line 1298, in has_metadata
File "/usr/local/lib/python2.7/site-packages/virtualenv-1.11-py2.7.egg/virtualenv_support/setuptools-2.0.2-py2.py3-none-any.whl/pkg_resources.py", line 1614, in _has
File "/usr/local/lib/python2.7/site-packages/virtualenv-1.11-py2.7.egg/virtualenv_support/setuptools-2.0.2-py2.py3-none-any.whl/pkg_resources.py", line 1488, in _zipinfo_name
AssertionError: /usr/local/lib/python2.7/site-packages/virtualenv-1.11-py2.7.egg/EGG-INFO/PKG-INFO is not a subpath of /usr/local/lib/python2.7/site-packages/virtualenv-1.11-py2.7.egg/virtualenv_support/setuptools-2.0.2-py2.py3-none-any.whl/
----------------------------------------
...Installing setuptools, pip...done.
Traceback (most recent call last):
File "/usr/local/bin/virtualenv-2.7", line 9, in <module>
load_entry_point('virtualenv==1.11', 'console_scripts', 'virtualenv-2.7')()
File "/usr/local/lib/python2.7/site-packages/virtualenv-1.11-py2.7.egg/virtualenv.py", line 820, in main
symlink=options.symlink)
File "/usr/local/lib/python2.7/site-packages/virtualenv-1.11-py2.7.egg/virtualenv.py", line 988, in create_environment
install_wheel(to_install, py_executable, search_dirs)
File "/usr/local/lib/python2.7/site-packages/virtualenv-1.11-py2.7.egg/virtualenv.py", line 956, in install_wheel
'PIP_NO_INDEX': '1'
File "/usr/local/lib/python2.7/site-packages/virtualenv-1.11-py2.7.egg/virtualenv.py", line 898, in call_subprocess
% (cmd_desc, proc.returncode))
OSError: Command /home/prem/PythonProjects/ENV/bin/python2.7 -c "import sys, pip; pip...ll\"] + sys.argv[1:])" setuptools pip failed with error code 1

最佳答案

我曾经遇到过这个问题。

我想可能是pip的问题。

因此,我按照以下链接的说明安装适用于 python 2.7 的 pip。

wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py
sudo /usr/local/bin/python2.7 ez_setup.py
sudo /usr/local/bin/easy_install-2.7 pip

然后

virtualenv -p /usr/local/bin/python2.7 env

成功了。

请查看下面的链接。
https://github.com/0xdata/h2o/wiki/Installing-python-2.7-on-centos-6.3.-Follow-this-sequence-exactly-for-centos-machine-only#installing-and-configuring-distribute-setuptools

仅供引用

关于python - 无法使用 virtualenv-2.7 创建 Virtualenv,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21190179/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com