Fix Python – Can existing virtualenv be upgraded gracefully?


Asked By – Matt Norris

I have a virtualenv created for Python 2.5 and want to “upgrade” it to Python 2.6.

Here is how it was originally set up:

virtualenv --no-site-packages -p python2.5 myenv

I now run virtualenv in the same directory to upgrade:

virtualenv --no-site-packages -p python2.6 myenv
Not overwriting existing python script myenv/bin/python (you must use myenv/bin/python2.6)
Overwriting myenv/bin/activate with new content

The default python is still 2.5, even though I can also specify 2.6. Is there any way to remove 2.5 entirely and have ‘bin/python’ point to 2.6 instead?

Now we will see solution for issue: Can existing virtualenv be upgraded gracefully?


You can use the Python 2.6 virtualenv to “revirtual” the existing directory. You will have to reinstall all the modules you installed though. I often have a virtual directory for developing a module, and virtualenv the same directory with many versions of Python, and it works just fine. 🙂

This question is answered By – Lennart Regebro

This answer is collected from stackoverflow and reviewed by FixPython community admins, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0