简体   繁体   English

在 Mac OSX sierra 上创建 virtualenv 时出错

[英]Error creating virtualenv on Mac OSX sierra

My problem has nothing to do with conda.我的问题与conda无关。

~$ virtualenv venv
New python executable in /Users/john/venv/bin/python
Installing setuptools, pip, wheel...
  Complete output from command /Users/john/venv/bin/python - setuptools pip wheel:
  Traceback (most recent call last):
  File "<stdin>", line 7, in <module>
  File "/Library/Python/2.7/site-packages/virtualenv_support/pip-8.0.2-py2.py3-none-any.whl/pip/__init__.py", line 4, in <module>
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/logging/__init__.py", line 26, in <module>
    import sys, os, time, cStringIO, traceback, warnings, weakref, collections
  File "traceback.py", line 21, in <module>
    traceback.print_exception(exc_type, exc_value, exc_traceback, file=f)
AttributeError: 'module' object has no attribute 'print_exception'
----------------------------------------
...Installing setuptools, pip, wheel...done.
Traceback (most recent call last):
  File "/usr/local/bin/virtualenv", line 11, in <module>
    sys.exit(main())
  File "/Library/Python/2.7/site-packages/virtualenv.py", line 711, in main
    symlink=options.symlink)
  File "/Library/Python/2.7/site-packages/virtualenv.py", line 944, in create_environment
    download=download,
  File "/Library/Python/2.7/site-packages/virtualenv.py", line 900, in install_wheel
    call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=SCRIPT)
  File "/Library/Python/2.7/site-packages/virtualenv.py", line 795, in call_subprocess
    % (cmd_desc, proc.returncode))
OSError: Command /Users/john/venv/bin/python - setuptools pip wheel failed with error code 1

I also can't find this file: File "traceback.py", line 21, in我也找不到这个文件:文件“traceback.py”,第 21 行,在

Any clues will be appreciated.任何线索将不胜感激。

I have the same problem on ubuntu on VM ware.我在虚拟机上的 ubuntu 上遇到了同样的问题。 I find the solution here我在这里找到解决方案

pip install pip -U
pip install pipenv -U
pip install virtualenv -U

I had this happen to me today, and I spent several hours trying to fix it until I tried uninstalling and reinstalling virtualenv which fixed the problem. 我今天遇到了这种情况,我花了几个小时尝试修复它,直到尝试卸载并重新安装virtualenv才解决了问题。

sudo pip uninstall virtualenv
sudo pip install virtualenv

Run this in your unactivated Mac OS X supplied python environment and then you can make python 3.6 virtualenvs by specifying the -p argument like normal, and everything works. 在未激活的Mac OS X提供的python环境中运行此命令,然后可以像正常一样通过指定-p参数来制作python 3.6 virtualenvs,然后一切正常。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM