Sunday, February 3, 2013

Install New Python on CentOS Linux

安裝較新版本 Python 於 CentOS 5 Linux,最方便的方法是安裝 Extra Packages for Enterprise Linux (EPEL) 的 python26 套件。

1. 查看 CentOS 5 系統安裝的 Python 版本(位於 /usr/bin/python)。
$ python -V
Python 2.4.3

2. 增加 RHEL EPEL repository 至系統,參考 Installing RHEL EPEL Repo on Centos 5.x or 6.x

3. 安裝 EPEL 的 python26 套件。
$ sudo yum install python26

除了安裝 python26,因為 Dependency 關係,也會安裝另外兩個套件,共安裝以下三個套件(使用 64 位元主機)。
python26: python26-2.6.8-2.el5.x86_64.rpm (來自 epel repository)
python26-libs: python26-libs-2.6.8-2.el5.x86_64.rpm  (來自 epel repository)
libffi: libffi-3.0.9-1.el5.rf.x86_64.rpm (來自 rpmforge repository)

4. 查看安裝後的 Python 版本(位於 /usr/bin/python26)。
$ python26 -V
Python 2.6.8

No comments:

Post a Comment