先卸载自带的python3
centos7 自带python2.7和python3.6
卸载自带的python3.6,重新安装python3.7
卸载python3.6
#卸载python3
rpm -qa|grep python3|xargs rpm -ev --allmatches --nodeps
#删除所有残余文件
whereis python3 |xargs rm -frv
#查看现有安装的python,验证是否删除干净
whereis python
安装python3.7
## 可以在这里https://www.python.org/ftp/python/找到你要安装的python3的版本.tgz文件,以下以3.7.2为例。
安装
wget https://www.python.org/ftp/python/3.7.2/Python-3.7.2.tgz
解压
tar zxvf Python-3.7.2.tgz
安装环境
yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel gcc libffi-devel gcc make automake autoconf libtool libffi-devel
进入目录
cd Python-3.7.2
初始配置
./configure --prefix=/usr/local/python3
安装
make && make install
配置软连接
ln -s /usr/local/python3/bin/python3.7 /usr/bin/python3
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
验证成功
python3 -V
pip3 -V
参考链接:
https://blog.csdn.net/qq_39091354/article/details/86584046
标签:python,devel,centos7,3.7,usr,安装,python3,Python2
From: https://www.cnblogs.com/chaishengblog/p/17103687.html