尝试在Ubuntu上创建虚拟环境时遇到以下问题:
$ mkvirtualenv test
New python executable in /home/ubuntu/.virtualenvs/test/bin/python
Installing setuptools, pip, wheel...
Complete output from command /home/ubuntu/.virtualenvs/test/bin/python - setuptools pip wheel:
Traceback (most recent call last):
File "<stdin>", line 7, in <module>
File "/home/ubuntu/anaconda2/lib/python2.7/site-packages/virtualenv_support/pip-8.1.1-py2.py3-none-any.whl/pip/__init__.py", line 16, in <module>
File "/home/ubuntu/anaconda2/lib/python2.7/site-packages/virtualenv_support/pip-8.1.1-py2.py3-none-any.whl/pip/vcs/mercurial.py", line 9, in <module>
File "/home/ubuntu/anaconda2/lib/python2.7/site-packages/virtualenv_support/pip-8.1.1-py2.py3-none-any.whl/pip/download.py", line 39, in <module>
File "/home/ubuntu/anaconda2/lib/python2.7/site-packages/virtualenv_support/pip-8.1.1-py2.py3-none-any.whl/pip/_vendor/requests/__init__.py", line 58, in <module>
File "/home/ubuntu/anaconda2/lib/python2.7/site-packages/virtualenv_support/pip-8.1.1-py2.py3-none-any.whl/pip/_vendor/requests/utils.py", line 26, in <module>
File "/home/ubuntu/anaconda2/lib/python2.7/site-packages/virtualenv_support/pip-8.1.1-py2.py3-none-any.whl/pip/_vendor/requests/compat.py", line 7, in <module>
File "/home/ubuntu/anaconda2/lib/python2.7/site-packages/virtualenv_support/pip-8.1.1-py2.py3-none-any.whl/pip/_vendor/requests/packages/__init__.py", line 29, in <module>
ImportError: No module named urllib3
----------------------------------------
...Installing setuptools, pip, wheel...done.
Traceback (most recent call last):
File "/home/ubuntu/anaconda2/bin/virtualenv", line 11, in <module>
sys.exit(main())
File "/home/ubuntu/anaconda2/lib/python2.7/site-packages/virtualenv.py", line 708, in main
symlink=options.symlink)
File "/home/ubuntu/anaconda2/lib/python2.7/site-packages/virtualenv.py", line 941, in create_environment
download=download,
File "/home/ubuntu/anaconda2/lib/python2.7/site-packages/virtualenv.py", line 897, in install_wheel
call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=SCRIPT)
File "/home/ubuntu/anaconda2/lib/python2.7/site-packages/virtualenv.py", line 792, in call_subprocess
% (cmd_desc, proc.returncode))
OSError: Command /home/ubuntu/.virtualenvs/test/bin/python - setuptools pip wheel failed with error code 1
有关如何解决此问题的任何想法?我已经尝试this,工作正常,但使用mkvirtualenv仍然没有好处。
答案 0 :(得分:0)
这似乎是使用Anaconda的一个特定问题。您可以使用默认的python创建virtualenv:
mkvirtualenv test -p /usr/bin/python