views:

587

answers:

2

I have a Debian system currently running with python 2.5.4. I got virtualenv properly installed, everything is working fine. Is there a possibility that I can use a virtualenv with a different version of Python?

I compiled Python 2.6.2 and would like to use it with some virtualenv. Is it enough to overwrite the binary file? Or do I have to change something in respect to the libraries?

+9  A: 

Just use the -p flag when creating your virtualenv instance to specify the Python executable you want to use, eg:

virtualenv -p python2.6
Daniel Roseman
does this have to be only the binary?
Ulf
I figured I'd mention that this works for virtualenvwrappers too: mkvirtualenv -p python2.6 env
bias
+4  A: 

virtualenv --python=/usr/bin/python2.6 myvirtualenv

iElectric
This works well for my under Ubuntu 9.10 (though the platform probably doesn't matter). Looks like you added an extra whitespace in the command between python and 2.6 that should not be there, however. virtualenv --python=/usr/bin/python2.6 myvirtualenv
RjOllos
Thanks, fixed it.
iElectric
Thank you so much for this!
Spike