The Server I use now is CentOS release 5.4 (Final), but Python is still 2.4.3, which is relatively low. I always want to update it. The last time Python was forcibly uninstalled, yum and some basic commands could not be used. Therefore, do not uninstall the old version. The new and old versions can coexist.
I found some materials in several foreign forums and executed the following command to install Python 2.6:
$ Rpm-Uvh http://yum.chrislea.com/centos/5/i386/chl-release-5-3.noarch.rpm
$ Rpm -- import/etc/pki/rpm-gpg/RPM-GPG-KEY-CHL
$ Rpm-Uvh http://download.Fedora.RedHat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm
$ Yum install libffi
$ Yum install python26
The result is as follows:
$ Python26
Python 2.6.2 (r262: 71600, Sep 8 2009, 13:06:43)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-44)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
This also encountered an error:
Python26-2.6.2-2.i386 from chlorophyll has depsolving problems
--> Missing Dependency: libffi. so.5 is needed by package python26-2.6.2-2.i386)
Error: Missing Dependency: libffi. so.5 is needed by package python26-2.6.2-2.i386 (chlorophyll)
This is because there is no libffi on which the installation program depends. After you run the 3rd and 4th lines of commands to install libffi, the problem is solved.