简体   繁体   中英

Error creating virtualenv on Mac OSX sierra

My problem has nothing to do with 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

Any clues will be appreciated.

I have the same problem on ubuntu on VM ware. 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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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