venv Python使用不正确的sys.prefix

5 python virtualenv enthought

我在mac Mountain Lion上运行canopy 64 bit版本:1.0.3.1262.我已经使用easy_install安装了virtualenv.但是在我尝试执行命令时:

virtualenv venv --distribute
Run Code Online (Sandbox Code Playgroud)

它显示以下错误:

Using base prefix '/Applications/Canopy.app/appdata/canopy-1.0.3.1262.macosx-x86_64/Canopy.app/Contents'
New python executable in venv/bin/python
dyld: Library not loaded: @rpath/Python
Referenced from: /Users/xxx/Desktop/untitled folder 2/venv/bin/python
Reason: image not found
ERROR: The executable venv/bin/python is not functioning
ERROR: It thinks sys.prefix is u'/Users/xxx/Desktop/untitled folder 2' (should be u'/Users/xxx/Desktop/untitled folder 2/venv')
ERROR: virtualenv is not compatible with this system or executable 
Run Code Online (Sandbox Code Playgroud)

有没有人有类似的问题并解决了它?提前感谢您提出宝贵意见.

Ben*_*Ben 3

Canopy 使用venv而不是virtualenv

尝试像这样设置您的环境:

venv -s path/to/virtual_environment_dir
Run Code Online (Sandbox Code Playgroud)

摘自: https: //support.enthought.com/entries/21802240-Use-venv-not-virtualenv-with-Canopy-Python

或者,如果您想要设置没有系统站点包的环境:设置没有系统站点包的虚拟环境 (venv)