Virtualenv因OSError而在OS X Yosemite上失败

时间:2014-10-26 16:04:04

标签: python pip virtualenv

我最近更新了OSX Yosemite,现在我无法使用virtualenv / pip

每当我执行:

virtualenv env

它抛出一个:

OSError: Command /Users/administrator...ux/env/bin/python2.7 -c "import sys, pip; sys...d\"] + sys.argv[1:]))" setuptools pip failed with error code 1

在该堆栈中,跟踪pip抛出:

ImportError: cannot import name HTTPSHandle

还有其他人遇到此错误吗?这些问题建议更新自制软件以解决问题。我已经完成但问题仍然存在。

完整堆栈跟踪:

Administrators-MacBook-Air :: ~/dev/KaggleAux ‹master› » virtualenv env                                                                                                                               127 ↵
New python executable in env/bin/python2.7
Also creating executable in env/bin/python
Installing setuptools, pip...
  Complete output from command /Users/administrator...ux/env/bin/python2.7 -c "import sys, pip; sys...d\"] + 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_support/pip-1.5.6-py2.py3-none-any.whl/pip/__init__.py", line 10, in <module>
  File "/usr/local/lib/python2.7/site-packages/virtualenv_support/pip-1.5.6-py2.py3-none-any.whl/pip/util.py", line 18, in <module>
  File "/usr/local/lib/python2.7/site-packages/virtualenv_support/pip-1.5.6-py2.py3-none-any.whl/pip/_vendor/distlib/version.py", line 14, in <module>
  File "/usr/local/lib/python2.7/site-packages/virtualenv_support/pip-1.5.6-py2.py3-none-any.whl/pip/_vendor/distlib/compat.py", line 31, in <module>
ImportError: cannot import name HTTPSHandler
----------------------------------------
...Installing setuptools, pip...done.
Traceback (most recent call last):
  File "/usr/local/bin/virtualenv", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/site-packages/virtualenv.py", line 824, in main
    symlink=options.symlink)
  File "/usr/local/lib/python2.7/site-packages/virtualenv.py", line 992, in create_environment
    install_wheel(to_install, py_executable, search_dirs)
  File "/usr/local/lib/python2.7/site-packages/virtualenv.py", line 960, in install_wheel
    'PIP_NO_INDEX': '1'
  File "/usr/local/lib/python2.7/site-packages/virtualenv.py", line 902, in call_subprocess
    % (cmd_desc, proc.returncode))
OSError: Command /Users/administrator...ux/env/bin/python2.7 -c "import sys, pip; sys...d\"] + sys.argv[1:]))" setuptools pip failed with error code 1

1 个答案:

答案 0 :(得分:7)

解决:

brew uninstall python

brew install python 

pip install --upgrade pip

*注意:您还需要为您正在进行的任何当前项目进行新的pip安装。