我应该如何在CentOS 5.5(64位)上升级Python

我相信我正在CA AppLogic 3.0上运行CentOS 5.5(64位)。

uname -a

 Linux LINUX64 2.6.18-194.32.1.el5xen #1 SMP Wed Jan 5 18:44:24 EST 2011 x86_64 x86_64 x86_64 GNU/Linux 

我升级了yum upgrade ,但我的Python仍然在版本2.4.3。

yum info python

 Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirror.5ninesolutions.com * extras: mirrors.cmich.edu * updates: mirror.5ninesolutions.com Installed Packages Name : python Arch : x86_64 Version : 2.4.3 Release : 46.el5 Size : 72 k Repo : installed Summary : An interpreted, interactive, object-oriented programming language. URL : http://www.python.org/ License : PSF - see LICENSE Description: Python is an interpreted, interactive, object-oriented programming : language often compared to Tcl, Perl, Scheme or Java. Python : includes modules, classes, exceptions, very high level dynamic data : types and dynamic typing. Python supports interfaces to many system : calls and libraries, as well as to various windowing systems (X11, : Motif, Tk, Mac and MFC). : : Programmers can write new built-in modules for Python in C or C++. : Python can be used as an extension language for applications that : need a programmable interface. This package contains most of the : standard Python modules, as well as modules for interfacing to the : Tix widget set for Tk and RPM. : : Note that documentation for Python is provided in the python-docs : package. 

我想我读了一个地方, yum依靠python所以我不应该删除。 那么我应该下载Python版本2.7.x作为源代码并编译它? 或者有没有办法用yum升级Python(不知何故)?

我正在计划使用Python的最新版本2.x的Django。

有epel回购的python26软件包。 这应该是更好,更容易的选项,然后手动安装。

但是,请注意,您可能无法用2.6或任何其他版本replace默认的python ,因为有很多东西为2.4构build,升级它将需要重新编译大量的软件包,所得到的系统将不会真的是CentOS 5.我觉得升级到CentOS 6比较容易,然后重build这么多的软件包。

是从源头上编译它:

 yum install gcc gcc-c++.x86_64 compat-gcc-34-c++.x86_64 openssl-devel.x86_64 zlib*.x86_64 

安装python 2.7

 wget http://www.python.org/ftp/python/2.7/Python-2.7.tar.bz2 tar -xvjf Python-2.7.tar.bz2 cd Python* ./configure --prefix=/opt/python27 make make install vi ~/.bash_profile replace PATH=$PATH:$HOME/bin with PATH=$PATH:$HOME/bin:/opt/python27/bin 

重新加载.bash_profile

 source ~/.bash_profile echo "/opt/python27/lib" > /etc/ld.so.conf.d/python27.conf ldconfig