无法使用虚拟环境

时间:2017-05-31 21:28:18

标签: python python-2.7 anaconda homebrew

我在Mac OS X Yosemite上。我的计算机上安装了anaconda,当我使用virtualenv foo创建一个新的virtualenv时,我收到错误:

...Installing setuptools, pip, wheel...done.
Traceback (most recent call last):
  File "/Users/lingxiao/anaconda/bin/virtualenv", line 11, in <module>
    sys.exit(main())
  File "/Users/lingxiao/anaconda/lib/python2.7/site-packages/virtualenv.py", line 713, in main
    symlink=options.symlink)
  File "/Users/lingxiao/anaconda/lib/python2.7/site-packages/virtualenv.py", line 945, in create_environment
    download=download,
  File "/Users/lingxiao/anaconda/lib/python2.7/site-packages/virtualenv.py", line 901, in install_wheel
    call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=SCRIPT)
  File "/Users/lingxiao/anaconda/lib/python2.7/site-packages/virtualenv.py", line 797, in call_subprocess
    % (cmd_desc, proc.returncode))
OSError: Command /Users/lingxiao/Docu...board/foo/bin/python - setuptools pip wheel failed with error code 1

这是因为Anaconda吗?当我which python时,我看到了

/Users/myname/anaconda/bin/python

当我列出brew list python时,我看到了:

/usr/local/Cellar/python/2.7.13/bin/2to3
/usr/local/Cellar/python/2.7.13/bin/2to3-2
/usr/local/Cellar/python/2.7.13/bin/2to3-2.7
/usr/local/Cellar/python/2.7.13/bin/idle
/usr/local/Cellar/python/2.7.13/bin/idle2
/usr/local/Cellar/python/2.7.13/bin/idle2.7
/usr/local/Cellar/python/2.7.13/bin/pydoc
/usr/local/Cellar/python/2.7.13/bin/pydoc2
/usr/local/Cellar/python/2.7.13/bin/pydoc2.7
/usr/local/Cellar/python/2.7.13/bin/python
/usr/local/Cellar/python/2.7.13/bin/python-config
/usr/local/Cellar/python/2.7.13/bin/python2
/usr/local/Cellar/python/2.7.13/bin/python2-config
/usr/local/Cellar/python/2.7.13/bin/python2.7
/usr/local/Cellar/python/2.7.13/bin/python2.7-config
/usr/local/Cellar/python/2.7.13/bin/pythonw
/usr/local/Cellar/python/2.7.13/bin/pythonw2
/usr/local/Cellar/python/2.7.13/bin/pythonw2.7
/usr/local/Cellar/python/2.7.13/bin/smtpd.py
/usr/local/Cellar/python/2.7.13/bin/smtpd2.7.py
/usr/local/Cellar/python/2.7.13/bin/smtpd2.py
/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/ (2102 files)
/usr/local/Cellar/python/2.7.13/IDLE.app/Contents/ (8 files)
/usr/local/Cellar/python/2.7.13/lib/pkgconfig/ (3 files)
/usr/local/Cellar/python/2.7.13/libexec/pip/ (291 files)
/usr/local/Cellar/python/2.7.13/libexec/setuptools/ (152 files)
/usr/local/Cellar/python/2.7.13/libexec/wheel/ (54 files)
/usr/local/Cellar/python/2.7.13/Python Launcher.app/Contents/ (17 files)
/usr/local/Cellar/python/2.7.13/share/man/ (3 files)
/usr/local/Cellar/python/2.7.13/share/python/ (315 files)

1 个答案:

答案 0 :(得分:1)

正如评论中所讨论的那样,该问题与http://github.com/pypa/virtualenv/issues/741http://github.com/conda/conda/issues/1367相关,后者提示The best solution I know of now is to downgrade to python 2.7.9,并得到了OP的确认。