我在一台运行Windows Server 2008 R2的机器上进行了Python 3.3.4的全新安装。我已经全局成功安装了最新版本的Setuptools、Pip和Virtualenv:
python ez_setup.py
easy_install pip
pip install virtualenv
现在,当我尝试使用virtualenv ENV
设置虚拟环境时,我会得到以下堆栈跟踪:
New python executable in ENV\Scripts\python.exe
Installing setuptools, pip...
Complete output from command [path redacted]\ENV\Scripts\python.exe -c "import sys, pip; sys...d\"] + sys.argv[1:]))" setuptools pip:
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named 'pip'
----------------------------------------
...Installing setuptools, pip...done.
Traceback (most recent call last):
File "C:\Python33\lib\runpy.py", line 160, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "C:\Python33\lib\runpy.py", line 73, in _run_code
exec(code, run_globals)
File "C:\Python33\Scripts\virtualenv.exe\__main__.py", line 9, in <module>
File "C:\Python33\lib\site-packages\virtualenv.py", line 824, in main
symlink=options.symlink)
File "C:\Python33\lib\site-packages\virtualenv.py", line 992, in create_environment
install_wheel(to_install, py_executable, search_dirs)
File "C:\Python33\lib\site-packages\virtualenv.py", line 960, in install_wheel
'PIP_NO_INDEX': '1'
File "C:\Python33\lib\site-packages\virtualenv.py", line 902, in call_subprocess
% (cmd_desc, proc.returncode))
OSError: Command [path redacted]\ENV\Scripts\python.exe -c "import sys, pip; sys...d\"] + sys.argv[1:]))" setuptools pip failed with error code 1
我以前从未见过这个错误,而且堆栈跟踪对我来说毫无意义。我可以在Python shell中成功地 import pip
。有人能帮我修复这个问题吗?
更新 当我提供--system-site-packages
标志时,env成功安装。
pip.exe
所在的路径已添加到系统环境变量Path
中。 - Priyank Patelpip
肯定在路径上;我可以使用where pip
找到它并使用pip
运行它。 - Benjamin Hodgson