-★出爺;3 发表于 2017-4-22 11:02:10

更新Python到2.7

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


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


查看系统当前python版本


   2:
# python


   1:

   3:
Python 2.4.3 (#1, May5 2011, 16:39:10)
   4:
on linux2
   5:
Type "help", "copyright", "credits" or "license" for more information.
   6:
>;>>
   7:
#




下载新版本的python
     1:
# wget   http://python.org/ftp/python/2.7.2/Python-2.7.2.tgz



  解压缩以及编译

   1:
# tar xvf Python-2.7.2.tar.bz2
   2:
# ./configure --prefix=/usr/local/python27
   3:
# make
   4:
# make install
   5:
# ls /usr/local/python27/ -al
   6:
total 28
   7:
drwxr-xr-x6 root root 4096 Jul 14 00:21 .
   8:
drwxr-xr-x 20 root root 4096 Jul 14 00:17 ..
   9:
drwxr-xr-x2 root root 4096 Jul 14 00:21 bin
10:
drwxr-xr-x3 root root 4096 Jul 14 00:21 include
11:
drwxr-xr-x4 root root 4096 Jul 14 00:21 lib
12:
drwxr-xr-x3 root root 4096 Jul 14 00:21 share




覆盖原来的python链接

   1:
# mv /usr/bin/python /usr/bin/python_old
   2:
# ln -s /usr/local/python27/bin/python /usr/bin/
   3:
# python
   4:
Python 2.7.2 (default, Jul 14 2011, 00:20:14)
   5:
on linux2
   6:
Type "help", "copyright", "credits" or "license" for more information.
   7:
>>>
页: [1]
查看完整版本: 更新Python到2.7