1、安装pyhton3.7 的依赖包
yum -y groupinstall "Development tools"
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 libffi-devel
2、下载python3.7的“源码”:
wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tar.xz
3、解压并编译安装:
tar -xJvf Python-3.7.0.tar.xz 4、用cd命令进入解压出来的Python文件夹 cd Python-3.7.0
5、用./方法执行configure,并指定安装到usr目录下
./configure --prefix=/usr/local/python3 --enable-shared6、开始编译安装
make && make install
7、配置环境变量, 创建软链接
--创建python3的软链接
ln -s /usr/local/python3/bin/python3 /usr/bin/python3 --创建pip的软链接
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
8、将编译目录下的libpython3.7m.so.1.0文件复制 cp /root/Python-3.7.0/libpython3.7m.so.1.0 /usr/lib64/libpython3.7m.so.1.0