Background:
Since I develop python programs that must run on different python versions, I have installed different versions of python on my computer.
I am using FC 13 so it came with python 2.6 pre-installed in /usr/bin/python2.6
and /usr/lib/python2.6
.
I installed python 2.5 from source, and to keep things neat, I used the --prefix=/usr
option, which installed python in /usr/bin/python2.5
and /usr/lib/python2.5
.
Now, when I run python
my prompt shows I am using version 2.5. However, I am having some issues with the install.
Package management:
Using easy_install, packages are always installed in /usr/lib/python2.6/site-packages/
. I downloaded setuptools
.egg for python 2.5 and tried to install it, but it gives me an error:
/usr/lib/python2.5/site-packages does NOT support .pth files
It seems that python2.5 is not in my PYTHONPATH. I thought the default install would add itself to the PYTHONPATH, but when I write echo $PYTHONPATH
at promt, I just receive an empty line.
Best Answer
The recommended way of having multiple Python versions installed is to install each from source - they will happily coexist together. You can then use virtualenv with the appropriate interpreter to install the required dependencies (using pip or easy_install). The trick to easier installation of multiple interpreters from source is to use:
instead of the more usual "sudo make install". This will add the version number to the executable (so you'd have python-2.5, python-2.6, python-3.2 etc) thus preventing any conflicts with the system version of Python.