Linux安全网 - Linux操作系统_Linux 命令_Linux教程_Linux黑客

会员投稿 投稿指南 本期推荐: 强烈推荐:Ylmf OS 3.0 正式版发布附迅雷高 XP系统下硬盘安装Fedora 14图文教程
搜索:
您的位置: Linux安全网 > Linux入门 > » 正文

CentOS 升级python2.6 到最新的python3.3

来源: 未知 分享至:
Centos 6.5版本发布了,但是里面使用的Python却是2.6.6的版本,对于想使用python新版本的朋友,可以自己升级python。

1.查看当前python的版本。

[root@linuxso.com]# python
Python 2.6.6 (r266:84292, Nov 22 2013, 12:16:22) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 

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

 yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make

3. 下载python 3.3 的源码包。

[root@localhost liukk]# wget http://mirrors.sohu.com/python/3.3.3/Python-3.3.3.tar.bz2
--2013-12-24 06:10:56--  http://mirrors.sohu.com/python/3.3.3/Python-3.3.3.tar.bz2
Resolving mirrors.sohu.com... 119.188.36.70
Connecting to mirrors.sohu.com|119.188.36.70|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 14122529 (13M) [application/octet-stream]
Saving to: “Python-3.3.3.tar.bz2”
 
58% [======================================================================================>                                                               ] 8,216,640    128K/s  eta 43s  

4. 安装python3.3

 tar jxvf Python-3.3.3.tar.bz2 -C /usr/local/src/
  cd /usr/local/src/Python-3.3.3/
  ./configure --prefix=/usr/local/python3.3
  make && make install

5. 配置python

   mv /usr/bin/python /usr/bin/python.bak

 ln -s /usr/local/python3.3/bin/python3.3 /usr/bin/python

6. 查看当python的版本

[root@localhost bin]# python
Python 3.3.3 (default, Dec 24 2013, 06:29:34) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux
Type "help", "copyright", "credits" or "license" for more information.

 

>>> 


Tags:
分享至:
最新图文资讯
1 2 3 4 5 6
验证码:点击我更换图片 理智评论文明上网,拒绝恶意谩骂 用户名:
关于我们 - 联系我们 - 广告服务 - 友情链接 - 网站地图 - 版权声明 - 发展历史