It's been some time since Python 2.5 became stable and released. Version 2.5 has plenty of new features that have helped me in deciding that it was time to go ahead and start using it for primary development of all my new projects. One of the reasons I was still using version 2.4 is that Gentoo hadn't upgraded 2.5 to the stable package system.
I decided to go ahead and unmask version 2.5 anyway. Installing Python 2.5 isn't very complicated and I'll leave the details out. I'll just mention that after unmasking Python with the ~x86 keyword and installing the package, you'll need to run the python-updater. Python-updater had it's own problems with not being able to find some packages it thought needed to be re-emerged but I found pretty much all of those were unneeded old dependencies and I simply un-emerged them.
When you update Python, you can still get to your old version of Python by tacking on the version number to the python command, e.g., /usr/bin/python2.4. Since the Python updater uses emerge to install your python dependencies in the site-packages of your Python installation and emerge unmerges the old versions, your old Python probably doesn't have all the site-packages any longer. This is only an issue if you find you need the old Python.
For me, I have a couple applications that didn't quite want to work with Python 2.5 for some reason. I decided to use VirtualEnv to work on those applications.
To install virtualenv, you need setuptools. That package was one of the packages transfered to the 2.5 site-packages install and was no longer available with python2.4.
To get around the issue, use ez_setup.py to install a 2.4 version of setuptools instead of using emerge.
cd <working dir>
/usr/bin/python2.4 ez_setup.py setuptools
- I simply used the virtualenv command that came with python2.5 but changed the interpreter to by python2.4 instead of python.
cp /usr/bin/virtualenv .
# edit virtualenv to have the correct interpreter line
vim < or whatever editor > virtualenv
------ snip local virtualenv ------
------ snip ----------------------
./virtualenv --no-site-packages <virtual env install dir>
cd <virtual env install dir>/bin/
ln -s python2.4 python
cd <working dir>
- Use the old python in it's virtual environment:
source <virtual env install dir>/bin/activate
Python 2.4.4 (#1, Mar 5 2008, 10:47:15)
[GCC 4.1.2 (Gentoo 4.1.2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Anyway, that's it. You can have a virtual environment that uses any version of Python you like on your system. I imagine this procedure would be somewhat similar on pretty much any Linux Distribution.