Update CentOS to Python 2.7

What is the best way to install Python 2.7 on CentOS? All the tutorials I'm seeing are either using a third party management system or manually installing a separate binary to co-exist with Python 2.4. Why is 2.4 needed, and how can I seamlessly install 2.7?


I ended up going with Python 2.7 and took the following steps:

  1. Download the source
  2. Update gcc and other build tools.
  3. configure && make && make altinstall

For Django:

  1. Removed django from the original 2.4 site-packages directory.
  2. Reinstalled django using python2.7 setup.py install.

A longer and much more detailed version can be found here.


Python 2.4 is incompatible with Python 2.6. CentOS packages and a lot of core features depend on python.

how can I seamlessly install 2.6?

For (for x64 change i386 to x86_64):

rpm -ivh http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/i386/epel-release-1-1.ius.el5.noarch.rpm
rpm -ivh http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/i386/ius-release-1.0-6.ius.el5.noarch.rpm
yum clean all
yum install python26

Then disable epel and ius (set enabled=0 in /etc/yum.repos.d/ius.repo and /etc/yum.repos.d/epel.repo)