centos 7 python2.7.5升级到3.5.2
系统 centos 7
软件包 python3.5.2 下载:wget https://www.python.org/ftp/python/3.5.2/Python-3.5.2.tgz
查看原有原有软件包
[[email protected] ~]# python -V
Python 2.7.5
创建Python-3.5.2的安装目录
[[email protected] ~]# mkdir /usr/local/python3.5.2
解压软件包
[[email protected] ~]# cd /usr/src
[[email protected] src]# tar zxf Python-3.5.2.tgz
进入目录
[[email protected] src]# cd Python-3.5.2/
编译
[[email protected] Python-3.5.2]# ./configure --prefix=/usr/local/python3.5.2
安装
[[email protected] Python-3.5.2]# make && make install
备份老版本
[[email protected] Python-3.5.2]# mv /usr/bin/python /usr/bin/python_2.7.5
创建软链接
[[email protected] Python-3.5.2]# ln -s /usr/local/python3.5.2/bin/python3.5 /usr/bin/python
查看现在版本
[[email protected] ~]# python -V
Python 3.5.2
升级完成