1

我在运行 virtualenv 时遇到问题,并且不断收到相同的错误代码:“setuptools pip wheel failed with error code 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$
4

1 回答 1

2

我会说 Anaconda 导致了冲突,但更具体地说,似乎 Anaconda 的 virtualenv 是问题所在。在我的 macbook 上运行which virtualenv(我遇到了同样的问题)/Users/me/anaconda/bin/virtualenv在 linux 系统上运行时会产生收益,我刚刚在 yield 上进行了测试/usr/local/bin/virtualenv

所以,在 OS X 上,我使用/usr/local/bin/pip install virtualenv. 这不会在 PATH 文件夹中创建 virtualenv 二进制文件(或者它没有为我创建),所以我不得不输入这个令人痛苦的长命令:

sudo /usr/local/bin/python... {系统python的站点包文件夹中virtualenv.py的路径} new_env

并且做到了。但这很荒谬。没有人愿意这样做 - 即使创建链接仍然会在您不需要时破解它。

根据关于这个主题的 ContinuumIO github 页面,virtualenv envandsource /bin/activate命令被替换为conda create -n env python=2.7and source activate env

在我的 macbook 上测试(在 OS Yosemite 上运行 Anaconda2 v4),它成功了。

于 2016-04-26T13:39:46.167 回答