Search code examples
pythonvirtualenvpiphomebreweasy-install

virtualenv only creates /lib/Python2.6 when I also have Python2.7 (OS X)


I installed virtualenv on my new MacBook Pro (first time Mac user) before I did anything else (probably a bad idea). When I create an env it contains /lib/Python2.6 inside of it. Afterward I installed Python2.7, but it still only includes a Python2.6 folder in lib, so I assume something is messed up.

Note: If I go to terminal and type python, I correctly get Python2.7.

I've tried to reinstall virtualenv via:

pip install virtualenv --upgrade

and, also

easy_install virtualenv

Both had the same result. They worked fine with no problems, but I still get no Python2.7 folder in lib on new envs (note: I closed and reopened the terminal each time I upgraded to be safe)...

On a side note, I also tried:

brew install virtualenv

but got the following error:

Error: No available formula for virtualenv

Solution

  • virtualenv foo_env --python=Python2.7
    

    When you pass the python argument, it sets up the bin and lib for that version (assuming you have that version installed, of course).