virtualenv搭建虚拟环境报错解决办法

$ virtualenv python-serve

New python executable in /home/zx/soft/python-serve/bin/python

Installing setuptools, pip, wheel...
  Complete output from command /home/zx/soft/python-serve/bin/python - setuptools pip wheel:
  Traceback (most recent call last):
  File "", line 11, in
  File "/home/zx/anaconda2/lib/python2.7/site-packages/virtualenv_support/pip-9.0.3-py2.py3-none-any.whl/pip/__init__.py", line 5, in
  File "/home/zx/anaconda2/lib/python2.7/logging/__init__.py", line 26, in
    import sys, os, time, cStringIO, traceback, warnings, weakref, collections
  File "/home/zx/anaconda2/lib/python2.7/weakref.py", line 14, in
    from _weakref import (
ImportError: cannot import name _remove_dead_weakref
----------------------------------------
...Installing setuptools, pip, wheel...done.
Traceback (most recent call last):
  File "/home/zx/anaconda2/bin/virtualenv", line 11, in
    sys.exit(main())
  File "/home/zx/anaconda2/lib/python2.7/site-packages/virtualenv.py", line 712, in main
    symlink=options.symlink)
  File "/home/zx/anaconda2/lib/python2.7/site-packages/virtualenv.py", line 953, in create_environment
    download=download,
  File "/home/zx/anaconda2/lib/python2.7/site-packages/virtualenv.py", line 904, in install_wheel
    call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=SCRIPT)
  File "/home/zx/anaconda2/lib/python2.7/site-packages/virtualenv.py", line 796, in call_subprocess
    % (cmd_desc, proc.returncode))

OSError: Command /home/zx/soft/python-serve/bin/python - setuptools pip wheel failed with error code 1



解决办法

$ sudo virtualenv -p python3 python-serve
Running virtualenv with interpreter /usr/bin/python3
Using base prefix '/usr'
New python executable in /home/zx/soft/python-serve/bin/python3
Not overwriting existing python script /home/zx/soft/python-serve/bin/python (you must use /home/zx/soft/python-serve/bin/python3)
Installing setuptools, pip, wheel...done.

你可能感兴趣的:(virtualenv搭建虚拟环境报错解决办法)