centos 升级python2.6 到python3.3

 Centos 6.5版本发布了,但是里面使用的python却是2.6.6的版本,对于想使用python新版本的朋友,可以自己升级python。

1.查看当前python的版本。

[java]  view plain copy 在CODE上查看代码片 派生到我的代码片
  1. [root@localhost liukk]# python  
  2. Python 2.6.6 (r266:84292, Nov 22 201312:16:22)   
  3. [GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2  
  4. Type "help""copyright""credits" or "license" for more information.  
  5. >>>   

2. 安装升级相应的软件包。

[html]  view plain copy 在CODE上查看代码片 派生到我的代码片
  1. yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make  

3. 下载python 3.3 的源码包。

[html]  view plain copy 在CODE上查看代码片 派生到我的代码片
  1. [root@localhost liukk]# wget http://mirrors.sohu.com/python/3.3.3/Python-3.3.3.tar.bz2  
  2. --2013-12-24 06:10:56--  http://mirrors.sohu.com/python/3.3.3/Python-3.3.3.tar.bz2  
  3. Resolving mirrors.sohu.com... 119.188.36.70  
  4. Connecting to mirrors.sohu.com|119.188.36.70|:80... connected.  
  5. HTTP request sent, awaiting response... 200 OK  
  6. Length: 14122529 (13M) [application/octet-stream]  
  7. Saving to: “Python-3.3.3.tar.bz2”  
  8.   
  9. 58% [======================================================================================>                                                               ] 8,216,640    128K/s  eta 43s    

 4. 安装python3.3

  
[html]  view plain copy 在CODE上查看代码片 派生到我的代码片
  1. tar jxvf Python-3.3.3.tar.bz2 -C /usr/local/src/  
  2.  cd /usr/local/src/Python-3.3.3/  
  3.  ./configure --prefix=/usr/local/python3.3  
  4.  make && make install  
  安装完之后可以在/usr/local/src/python3.3/bin 目录下看到python3.3

5. 配置python

  
[html]  view plain copy 在CODE上查看代码片 派生到我的代码片
  1. mv /usr/bin/python /usr/bin/python.bak  
  2. ln -s /usr/local/python3.3/bin/python3.3 /usr/bin/python  

6. 查看当python的版本

[html]  view plain copy 在CODE上查看代码片 派生到我的代码片
  1. [root@localhost bin]# python  
  2. Python 3.3.3 (default, Dec 24 2013, 06:29:34)   
  3. [GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux  
  4. Type "help", "copyright", "credits" or "license" for more information.  
  5. >>>   

 至此,centos python3.3 版本安装完毕,可以尽情遨游python coding 了。


原文:http://blog.csdn.net/harith/article/details/17538233

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值