创建virtualenv时出错。错误说明了python3

时间:2015-10-14 09:56:09

标签: python ubuntu virtualenv

尝试创建virtualenv时出现以下错误。

vagrant@vagrant-ubuntu-trusty-32:/vagrant$ virtualenv test2
Using base prefix '/usr'
New python executable in test2/bin/python3
Also creating executable in test2/bin/python
Traceback (most recent call last):
  File "/usr/local/bin/virtualenv", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.4/dist-packages/virtualenv.py", line 832, in main
    symlink=options.symlink)
  File "/usr/local/lib/python3.4/dist-packages/virtualenv.py", line 994, in create_environment
    site_packages=site_packages, clear=clear, symlink=symlink))
  File "/usr/local/lib/python3.4/dist-packages/virtualenv.py", line 1427, in install_python
    os.symlink(py_executable_base, full_pth)
OSError: [Errno 71] Protocol error: 'python3' -> 'test2/bin/python'
vagrant@vagrant-ubuntu-trusty-32:/vagrant$

我在尝试进入virtualenv时也遇到错误。以下尝试均无效:

source test2/bin/activate
source test2/bin/python/activate
source test2/bin/python3/activate

1 个答案:

答案 0 :(得分:6)

你需要添加--always-copy标志和virtualenv test2的结束,或者在/ vagrant文​​件夹之外运行virtualenv test2。