更新Python到2.7

眼看着python3 都出来了,vps上用的还是2.4的版本额,确实汗了一把。决定升级下python。

python2.7是2.X的最后一个版本,同时她也加入了一部分3.X的新特性。so 让我们升级吧!
查看系统当前python版本
   2:

 [root@wangyuelou ~]# python
   1:

  
   3:

 Python 2.4.3 (#1, May  5 2011, 16:39:10) 
   4:

 [GCC 4.1.2 20080704 (Red Hat 4.1.2-50)] on linux2
   5:

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

 >;>> 
   7:

 [root@wangyuelou ~]# 
下载新版本的python

解压缩 以及编译

   1:

 [root@wangyuelou ~]# tar xvf Python-2.7.2.tar.bz2 
   2:

 [root@wangyuelou Python-2.7.2]# ./configure --prefix=/usr/local/python27
   3:

 [root@wangyuelou Python-2.7.2]# make
   4:

 [root@wangyuelou Python-2.7.2]# make install
   5:

 [root@wangyuelou Python-2.7.2]# ls /usr/local/python27/ -al
   6:

 total 28
   7:

 drwxr-xr-x  6 root root 4096 Jul 14 00:21 .
   8:

 drwxr-xr-x 20 root root 4096 Jul 14 00:17 ..
   9:

 drwxr-xr-x  2 root root 4096 Jul 14 00:21 bin
  10:

 drwxr-xr-x  3 root root 4096 Jul 14 00:21 include
  11:

 drwxr-xr-x  4 root root 4096 Jul 14 00:21 lib
  12:

 drwxr-xr-x  3 root root 4096 Jul 14 00:21 share
覆盖原来的python链接
   1:

 [root@wangyuelou Python-2.7.2]# mv /usr/bin/python /usr/bin/python_old
   2:

 [root@wangyuelou Python-2.7.2]# ln -s /usr/local/python27/bin/python /usr/bin/
   3:

 [root@wangyuelou Python-2.7.2]# python
   4:

 Python 2.7.2 (default, Jul 14 2011, 00:20:14) 
   5:

 [GCC 4.1.2 20080704 (Red Hat 4.1.2-50)] on linux2
   6:

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

 >>> 
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值