将Python自带版本(2.6.6)升级到2.7.9
查看当前python版本:#pythonPython2.6.6(r266:84292,Jan22,09:42:36)
[GCC4.4.70313(RedHat4.4.7-4)]onlinux2Type
"help","copyright","credits"or"license"formoreinformation.
下载2.7.9版本:#wget/ftp/python/2.7.9/Python-2.7.9.tgz
解压#tarxvfPython-2.7.2.tar.bz2
编译安装#./configure--prefix=/usr/local/python27
#make
#makeinstall
更改新版本Python链接#mv/usr/bin/python/usr/bin/python_old
#ln-s/usr/local/python27/bin/python/usr/bin/
#python
Python到此算是更新完成了:#pythonPython2.7.9(default,May9,09:43:27)
[GCC4.4.70313(RedHat4.4.7-16)]onlinux2Type
"help","copyright","credits"or"license"formoreinformation.
安装后一些修改调试
安装后默认指定的yum无法正常运行,这个时候需要更改一下Python指定#vim/usr/bin/yum#!/usr/bin/python2.6#修改为旧版本
出现退格键乱码问题:Python2.7.9(default,May9,09:43:27)
[GCC4.4.70313(RedHat4.4.7-16)]onlinux2Type
"help","copyright","credits"or"license"formoreinformation.
>>>import^H^[[D
安装readline开发包:yuminstallreadline-devel.x86_64
在新版本Python中重新编译Python#makeinstall
Python更新到新版本工作到此完成。