标签:python 版本
将Python自带版本(2.6.6)升级到2.7.9
查看当前python版本:
# pythonPython 2.6.6 (r266:84292, Jan 22 2014, 09:42:36) [GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2Type "help", "copyright", "credits" or "license" for more information.
下载2.7.9版本:
# wget http://python.org/ftp/python/2.7.9/Python-2.7.9.tgz
解压
# tar xvf Python-2.7.2.tar.bz2
编译安装
# ./configure --prefix=/usr/local/python27 # make # make install
更改新版本Python链接
#mv /usr/bin/python /usr/bin/python_old #ln -s /usr/local/python27/bin/python /usr/bin/ #python
Python到此算是更新完成了:
# pythonPython 2.7.9 (default, May 9 2016, 09:43:27) [GCC 4.4.7 20120313 (Red Hat 4.4.7-16)] on linux2Type "help", "copyright", "credits" or "license" for more information.
安装后一些修改调试
安装后默认指定的yum无法正常运行,这个时候需要更改一下Python指定
# vim /usr/bin/yum #!/usr/bin/python2.6 #修改为旧版本
出现退格键乱码问题:
Python 2.7.9 (default, May 9 2016, 09:43:27) [GCC 4.4.7 20120313 (Red Hat 4.4.7-16)] on linux2Type "help", "copyright", "credits" or "license" for more information. >>> import ^H^[[D
安装readline开发包:
yum install readline-devel.x86_64
在新版本Python中重新编译Python
#make install
Python更新到新版本工作到此完成。
标签:python 版本
原文地址:http://maoyao.blog.51cto.com/8253780/1771386