Install python 2.6 in CentOS
You could also use the EPEL-repository, and then do sudo yum install python26
to install python 2.6
Try epel
wget http://download.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
sudo rpm -ivh epel-release-5-4.noarch.rpm
sudo yum install python26
The python executable will be available at /usr/bin/python26
mkdir -p ~/bin
ln -s /usr/bin/python26 ~/bin/python
export PATH=~/bin:$PATH # Append this to your ~/.bash_profile for persistence
Now, python
command will execute python 2.6
When I've run into similar situations, I generally avoid the package manager, especially if it would be embarrassing to break something, i.e. a production server. Instead, I would go to Activestate and download their binary package:
https://www.activestate.com/activepython/downloads/
This is installed by running a script which places everything into a folder and does not touch any system files. In fact, you don't even need root permissions to set it up. Then I change the name of the binary to something like apy26, add that folder to the end of the PATH and start coding. If you install packages with apy26 setup.py install
or if you use virtualenv and easyinstall, then you have just as flexible a python environment as you need without touching the system standard python.
Edits... Recently I've done some work to build a portable Python binary for Linux that should run on any distro with no external dependencies. This means that any binary shared libraries needed by the portable Python module are part of the build, included in the tarball and installed in Python's private directory structure. This way you can install Python for your application without interfering with the system installed Python.
My github site has a build script which has been thoroughly tested on Ubuntu Lucid 10.04 LTS both 32 and 64 bit installs. I've also built it on Debian Etch but that was a while ago and I can't guarantee that I haven't changed something. The easiest way to do this is you just put your choice of Ubuntu Lucid in a virtual machine, checkout the script with git clone git://github.com/wavetossed/pybuild.git
and then run the script.
Once you have it built, use the tarball on any recent Linux distro. There is one little wrinkle with moving it to a directory other than /data1/packages/python272
which is that you have to run the included patchelf
to set the interpreter path BEFORE you move the directory. This affects any binaries in /data1/packages/python272/bin
All of this is based on building with RUNPATH and copying the dependent shared libraries. Even though the script is in several files, it is effectively one long shell script arranged in the style of /etc/rc.d directories.