PythonTip >> 博文 >> iteye

升级python(linux)

zihua 2013-09-28 23:09:08 点击: 752 | 收藏


查看系统当前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 ~]# wget http://python.org/ftp/python/2.7.2/Python-2.7.2.tgz
 
解压缩 以及编译
   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
原文链接:http://omyyal.iteye.com/blog/1918622

作者:zihua | 分类: iteye | 标签: python | 阅读: 752 | 发布于: 2013-09-28 23时 |