3424123 发表于 2016-5-10 09:29:14

将Python自带版本(2.6.6)升级到2.7.9

将Python自带版本(2.6.6)升级到2.7.9

查看当前python版本:

1
2
3
4
# python
Python 2.6.6 (r266:84292, Jan 22 2014, 09:42:36)
on linux2
Type "help", "copyright", "credits" or "license" for more information.





下载2.7.9版本:


1
# wget http://python.org/ftp/python/2.7.9/Python-2.7.9.tgz






解压

1
# tar xvf Python-2.7.2.tar.bz2






编译安装

1
2
3
# ./configure --prefix=/usr/local/python27
# make
# make install






更改新版本Python链接

1
2
3
#mv /usr/bin/python /usr/bin/python_old
#ln -s /usr/local/python27/bin/python /usr/bin/
#python




Python到此算是更新完成了:

1
2
3
4
# python
Python 2.7.9 (default, May9 2016, 09:43:27)
on linux2
Type "help", "copyright", "credits" or "license" for more information.





安装后一些修改调试
安装后默认指定的yum无法正常运行,这个时候需要更改一下Python指定

1
# vim /usr/bin/yum #!/usr/bin/python2.6   #修改为旧版本





出现退格键乱码问题:

1
2
3
4
Python 2.7.9 (default, May9 2016, 09:43:27)
on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import ^H^[[D




安装readline开发包:


1
yum install readline-devel.x86_64




在新版本Python中重新编译Python

1
#make install





Python更新到新版本工作到此完成。


页: [1]
查看完整版本: 将Python自带版本(2.6.6)升级到2.7.9