1. 官网下载源码包
2.解压
3. 安装Python 3.7依赖的包
yum -y install libffi-devel openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel gcc
进入python3.7解压后的目录
./configure --prefix=/usr/local/python3 --enable-shared CFLAGS= fPIC --with-ssl
make && make install
4.如果报错
python3: error while loading shared libraries: libpython3.5m.so.1.0: cannot open shared object fil
解决方法:cd /etc/ld.so.conf.d
vim python3.conf
添加库文件路径 /usr/local/Python3/lib
退出保存
运行ldconfig