python升级到最新版本下载_将Python自带版本(2.6.6)升级到2.7.9

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

查看当前python版本:

# python

Python 2.6.6 (r266:84292, Jan 22 2014, 09:42:36)

[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2

Type "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到此算是更新完成了:

# python

Python 2.7.9 (default, May  9 2016, 09:43:27)

[GCC 4.4.7 20120313 (Red Hat 4.4.7-16)] on linux2

Type "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 linux2

Type "help", "copyright", "credits" or "license" for more information.

>>> import ^H^[[D

安装readline开发包:

yum install readline-devel.x86_64

在新版本Python中重新编译Python

#make install

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值