我在运行virtualenv时遇到问题,并且我一直收到同样的错误代码:“setuptools pip wheel失败,错误代码为1”
我看到一些页面讨论了不同版本的setuptools之间的差异,但是我已经卸载并重新安装了几个版本的virtualenv和setuptools而没有结果。有谁知道这里发生了什么?
Roberts-MacBook-Air:script Rob$ virtualenv venv
New python executable in venv/bin/python
Installing setuptools, pip, wheel...
Complete output from command /Users/Rob/Seedstages/script/venv/bin/python -c "import sys, pip; sys...d\"] + sys.argv[1:]))" setuptools pip wheel:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Users/Rob/anaconda/lib/python2.7/site-packages/virtualenv_support/pip-7.1.2-py2.py3-none-any.whl/pip/__init__.py", line 13, in <module>
File "/Users/Rob/anaconda/lib/python2.7/site-packages/virtualenv_support/pip-7.1.2-py2.py3-none-any.whl/pip/utils/__init__.py", line 15, in <module>
File "/Users/Rob/anaconda/lib/python2.7/zipfile.py", line 6, in <module>
import io
File "/Users/Rob/anaconda/lib/python2.7/io.py", line 51, in <module>
import _io
ImportError: dlopen(/Users/Rob/Seedstages/script/venv/lib/python2.7/lib-dynload/_io.so, 2): Symbol not found: __PyErr_ReplaceException
Referenced from: /Users/Rob/Seedstages/script/venv/lib/python2.7/lib-dynload/_io.so
Expected in: dynamic lookup
----------------------------------------
...Installing setuptools, pip, wheel...done.
Traceback (most recent call last):
File "/Users/Rob/anaconda/bin/virtualenv", line 11, in <module>
sys.exit(main())
File "/Users/Rob/anaconda/lib/python2.7/site-packages/virtualenv.py", line 832, in main
symlink=options.symlink)
File "/Users/Rob/anaconda/lib/python2.7/site-packages/virtualenv.py", line 1004, in create_environment
install_wheel(to_install, py_executable, search_dirs)
File "/Users/Rob/anaconda/lib/python2.7/site-packages/virtualenv.py", line 969, in install_wheel
'PIP_NO_INDEX': '1'
File "/Users/Rob/anaconda/lib/python2.7/site-packages/virtualenv.py", line 910, in call_subprocess
% (cmd_desc, proc.returncode))
OSError: Command /Users/Rob/Seedstages/script/venv/bin/python -c "import sys, pip; sys...d\"] + sys.argv[1:]))" setuptools pip wheel failed with error code 1
Roberts-MacBook-Air:script Rob$
答案 0 :(得分:1)
我会说Anaconda会引发冲突,但更具体地说,似乎Anaconda的virtualenv就是问题所在。在我的macbook上运行which virtualenv
(我遇到同样的问题)在Linux系统上运行它时会产生/Users/me/anaconda/bin/virtualenv
我刚刚测试了这个产生/usr/local/bin/virtualenv
。
因此,在OS X上,我使用/usr/local/bin/pip install virtualenv
下载了virtualenv。这不会在PATH文件夹中创建virtualenv二进制文件(或者它对我来说没有),所以我不得不键入这个痛苦的长命令:
sudo /usr/local/bin/python
... {系统python&site-packages文件夹中virtualenv.py的路径} new_env
就是这样做的。但这太荒谬了。没有人愿意这样做 - 即使创建链接仍然会在你不需要时进行黑客攻击。
根据ContinuumIO github页面on this very subject,virtualenv env
和source /bin/activate
命令将替换为conda create -n env python=2.7
和source activate env
。
在我的Macbook上测试(在Yosemite OS上运行Anaconda2 v4)并且它已经完成了。