Skip to content


as4 升级默认python-2.3.4-14.4到2.6.2

RHEL 4 自带的Python有点旧了,为python-2.3.4-14.4版本的,所以决定升级到最新版本2.6.2。


rpm -qa |grep python

gnome-python2-2.6.0-3
mod_python-3.1.3-5
python-devel-2.3.4-14
libxml2-python-2.6.16-6
rpm-python-4.3.3-7_nonptl
gnome-python2-bonobo-2.6.0-3
dbus-python-0.22-11.EL
python-ldap-2.0.1-2
python-2.3.4-14
gnome-python2-canvas-2.6.0-3
MySQL-python-1.0.0-1.RHEL4.1

如果用

rpm -e python-2.3.4-14.4

是删除不了的,因为有程序依赖性的问题。

1. 下载最新源代码包

wget http://www.python.org/ftp/python/2.6.2/Python-2.6.2.tar.bz2
tar jxvf Python-2.6.2.tar.bz2
cd Python-2.6.2

2. 安装
(原始目录为/usr,以前的ptyhon可能有依赖关系,安装在新目录)

./configure –prefix=/usr/local
make
make install

3. 创建链接

mv /usr/bin/python /usr/bin/python_bak (保存原来的版本)
ln -s /usr/local/bin/python /usr/bin

4. 测试效果

python

Python 2.6.2 (r262:71600, May 13 2009, 14:52:27)
[GCC 3.4.6 20060404 (Red Hat 3.4.6-9)] on linux2
Type “help”, “copyright”, “credits” or “license” for more information.
>>>

参考:
http://bbs2.chinaunix.net/archiver/tid-1266412.html

Posted in linux 维护优化, 技术.

Tagged with .


4 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

  1. ttplay says

    为什么不强制删除?

  2. C1G says

    怕有依赖关系…安全起见就不删了

  3. loe says

    第三步是必须的吗?我安装完之后
    which python就直接是
    /usr/local/bin/python

  4. C1G says

    那就不需做第三步了。



Some HTML is OK

or, reply to this post via trackback.