python-2.7.13(编译安装)

更新python至2.7以上:

检查python版本

[root@www git-2.13.0]# python -V

Python 2.4.3

安装gcc编译器

[root@www ~]# yum -y install gcc

下载python源码

[root@www ~]# wget https://www.python.org/ftp/python/2.7.13/Python-2.7.13.tgz

安装python依赖

[root@www ~]# yum -y install openssl openssl-devel

注:Ubuntu执行 apt-get install -y openssl libssl.dev

 

 

编译安装python2.7

[root@www ~]# tar -zxf Python-2.7.13.tgz

[root@www ~]# cd Python-2.7.13

[root@www ~]#./configure ./configure --prefix=/usr/local/python-2.7.13 --enable-optimizations

[root@www ~]# make all

[root@www ~]# make install

[root@www ~]# make clean

[root@www ~]# make distclean

更改python命令指向python2.7

[root@www Python-2.7.13]# mv /usr/bin/python /usr/bin/python2.4

[root@www Python-2.7.13]# ln -s /usr/local/python-2.7.13/bin/python2.7 usr/local/bin/python2.7

[root@www Python-2.7.13]# python2.7 -V

Python 2.7.13  #更新成功


posted @ 2017-07-06 01:47  Czlun  阅读(509)  评论(0)    收藏  举报
Copyright @2021 Czlun
Powered by .NET 5.0 on Kubernetes