Skip to content Skip to sidebar Skip to footer

Many Problems With Python's Virtualenv

I've been having a lot of trouble with getting virtualenv to work. First I installed it via pip and then tried setting up a virtualenv. That didn't work and I got this error messag

Solution 1:

The problem is you have multiple versions of Python on your system.

You have the Python that ships with OSX (/Library/Frameworks/Python.framework/Versions/2.7/bin/python), then you have the Python that comes with Canopy; which is /Users/zachary/Library/Enthought/Canopy_64bit/User/bin/python.

Your path is pointing the default version to the one from Canopy, yet pip is installed against the default system version of Python.

So when you installed virtualenv, it was installed against the default version of Python; but when you try to create a virtual environment - due to the way your path are setup, it is trying to use the Canopy version of Python - and that's the source of your error.

To solve this problem you can do any of the following:

  1. Remove Canopy, and use the OSX version of Python.
  2. Install virtualenv on the Canopy version of Python.
  3. Modify your PATH so that the system version of Python takes precedence.
  4. Install another version of Python (from say, homebrew) and make that the default.

The resolution you chose will depend on what you need the system to do. If you need the libraries bundled with Canopy, then you need to choose option #2, otherwise pick any of the other options. #4 is the most disruptive (as it will involve installing a lot of other stuff).

Solution 2:

The Enthought Canopy website recommends this: to use venv, and not virtualenv.

Post a Comment for "Many Problems With Python's Virtualenv"