我现在使用的Server是CentOS release 5.4 (Final),但是Python还是2.4.3,比较低了,一直想更新一下。上次强行把Python卸载,导致yum和一些基本的命令用不了了。所以更新千万不要把老版本卸载了,新老版本可以共存的。
在几个外国论坛找到了一些资料,执行下面的命令安装2.6版本的Python:
$rpm -Uvh $rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CHL $rpm -Uvh Fedora.RedHat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm $yum install libffi $yum install python26
$rpm -Uvh $rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CHL $rpm -Uvh $yum install libffi $yum install python26最后顺利完成,结果如下:
$ 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. >>>
$ 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. >>>这其中也遇到一个错误:
python26-2.6.2-2.i386 from chl has depsolving problems --> Missing Dependency: libffi.so.5 is needed by package python26-2.6.2-2.i386 (chl) Error: Missing Dependency: libffi.so.5 is needed by package python26-2.6.2-2.i386 (chl)
python26-2.6.2-2.i386 from chl has depsolving problems --> Missing Dependency: libffi.so.5 is needed by package python26-2.6.2-2.i386 (chl) Error: Missing Dependency: libffi.so.5 is needed by package python26-2.6.2-2.i386 (chl)这是因为没有安装程序依赖的libffi,执行第3和第4行命令安装libffi后,问题解决。