centos下yum升级python到2.6


Warning: Use of undefined constant g_prettify_esc_callback - assumed 'g_prettify_esc_callback' (this will throw an Error in a future version of PHP) in /home/wwwroot/dbci/wp-content/plugins/g-prettify/prettify.php on line 19

python在linux上对很多程序都支持,但有些要高版本才可以安装或使用,但centos上默认的python才2.4,有些朋友怕升级python造成系统问题,所以今天给大家说下使用yum来升级.
系统:centos 5.5
需要的软件包:epel-release-5-4.noarch.rpm
1.查看目前的python版本

python -V
Python 2.4.3

可以看到目前python的版本是2.4.3

2.安装EPEL的rpm包

rpm -ivh http://download.slogra.com/epel-release-5-4.noarch.rpm

3.yum升级python

yum -y install python26

有些教程里要先yum安装libffi,其实不用,直接安装python26就会自动安装libffi.

4.备份老的python版本,并使用新python版本

mv /usr/bin/python /usr/bin/python.old
ln -s /usr/bin/python26 /usr/bin/python

5.检查python版本

python -V
Python 2.6.8

可以看到已经是2.6.8版本.事情还没有完,升级了python会造成yum无法使用的.

6.解决yum问题

vi /usr/bin/yum

将第一行的python后加上2.4,即第一行改为:

#!/usr/bin/python2.4

这样yum依然使用python 2.4环境运行,好了,就到这里吧.

点赞
  1. www.79203.com说道:

    Warning: Use of undefined constant g_prettify_esc_callback - assumed 'g_prettify_esc_callback' (this will throw an Error in a future version of PHP) in /home/wwwroot/dbci/wp-content/plugins/g-prettify/prettify.php on line 19
    Internet Explorer Windows XP
    嘻嘻,不错哦,谢谢博主分享了。
  2. www.iwandian.com说道:

    Warning: Use of undefined constant g_prettify_esc_callback - assumed 'g_prettify_esc_callback' (this will throw an Error in a future version of PHP) in /home/wwwroot/dbci/wp-content/plugins/g-prettify/prettify.php on line 19
    Google Chrome Windows 7
    我还没有开始玩 python呢
  3. 电影问答说道:

    Warning: Use of undefined constant g_prettify_esc_callback - assumed 'g_prettify_esc_callback' (this will throw an Error in a future version of PHP) in /home/wwwroot/dbci/wp-content/plugins/g-prettify/prettify.php on line 19
    Google Chrome Windows XP
    谢谢分享啊,
  4. 仙桃好房子说道:

    Warning: Use of undefined constant g_prettify_esc_callback - assumed 'g_prettify_esc_callback' (this will throw an Error in a future version of PHP) in /home/wwwroot/dbci/wp-content/plugins/g-prettify/prettify.php on line 19
    Google Chrome Windows XP
    不错,就是需要这样的技术贴

发表评论

电子邮件地址不会被公开。必填项已用 * 标注