1.查看版本
[root@localhost ~]# python -V
Python 2.6.6
2.下载编译安装python2.7.5版本源码包
[root@localhost ~]# cd /usr/local/src
[root@localhost ~]# wget https://www.python.org/ftp/python/2.7.5/Python-2.7.5.tgz
[root@localhost ~]# tar xvf Python-2.7.5.tgz
[root@localhost ~]# cd Python-2.7.5
[root@localhost ~]# ./configure
[root@localhost ~]# make all
[root@localhost ~]# make install
[root@localhost ~]# make clean
[root@localhost ~]# make distclean
3.将系统默认的python版本设置为2.7.5
[root@localhost ~]# rm /usr/bin/python
[root@localhost ~]# ln -s /usr/local/bin/python2.7 /usr/bin/python
4、检查升级后的python版本
[root@localhost ~]# python -V
Python 2.7.5
网友评论