views:

187

answers:

3

I'm setting up a virtualenv, but it seems to be using python2.5 by default.

I'm using this command

virtualenv newenv --no-site-packages -p python

because the python found on my path is python2.6. I believe this to be true because when I type python and go into the shell, it tells me it's 2.6. When I create the virtualenv with the above command and launch the shell, it tells me I'm in 2.5.

Anyone else have this issue?

A: 

using this as the location of python works on OSX 10.6

/System/Library/Frameworks/Python.framework/Versions/2.6/Python

Zach
A: 

On Mac OS X 10.5.8 Leopard, after running the 2.6.x dmg installer from Python.org:

virtualenv --no-site-packages newenv -p /Library/Frameworks/Python.framework/Versions/2.6/Python

Noting of course that 'newenv' is arbitrary. In fact, the syntax in the other link from iElectric is better since it puts the new name at the end:

virtualenv --no-site-packages --python=/Library/Frameworks/Python.framework/Versions/2.6/bin/python newenv

...

An aside: although that seems to work, I get errors due to some mixup with the 2.5 that's installed by default. Not sure if that matters:

/usr/local/bin/virtualenv:5: UserWarning: Module pkg_resources was already imported from /System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/pkg_resources.pyc, but /Library/Python/2.5/site-packages is being added to sys.path from pkg_resources import load_entry_point

Scott Lawton