CentOS系统更新Python

我现在使用的Server是CentOS release 5.4 (Final),但是Python还是2.4.3,比较低了,一直想更新一下。上次强行把Python卸载,导致yum和一些基本的命令用不了了。所以更新千万不要把老版本卸载了,新老版本可以共存的。

在几个外国论坛找到了一些资料,执行下面的命令安装2.6版本的Python:

  1. $rpm -Uvh http://yum.chrislea.com/centos/5/i386/chl-release-5-3.noarch.rpm   
  2. $rpm  --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CHL   
  3. $rpm -Uvh  http://download.Fedora.RedHat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm   
  4. $yum install libffi   
  5. $yum install python26  
$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

最后顺利完成,结果如下:

  1. $ python26   
  2. Python 2.6.2 (r262:71600, Sep  8 2009, 13:06:43)   
  3. [GCC 4.1.2 20080704 (Red Hat 4.1.2-44)] on linux2   
  4. Type "help""copyright""credits" or "license" for more information.   
  5. >>>  
$ 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.
>>>

这其中也遇到一个错误:

  1. python26-2.6.2-2.i386 from chl has depsolving problems   
  2.   --> Missing Dependency: libffi.so.5 is needed by package python26-2.6.2-2.i386 (chl)   
  3. 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后,问题解决。

相关推荐