Search code examples
pythonvirtualenventhought

venv Python uses incorrect sys.prefix


I am running canopy 64 bit Version: 1.0.3.1262 on mac Mountain Lion. I have installed virtualenv using easy_install. But while I am trying to execute the command:

virtualenv venv --distribute

It shows the following error:

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 

Have any one had similar issue and solved it? Thank you in advance for valuable advice.


Solution

  • Canopy uses venv instead of virtualenv

    Try setting up your environment like so:

    venv -s path/to/virtual_environment_dir
    

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

    or if you want to set up an environment without the system site packages: Setting up a virtural enviroment (venv) with no system site packages