yum install -y \
zlib \
zlib-devel \
sqlite-devel \
bzip2-devel \
libffi \
libffi-devel \
uuid \
uuid-devel \
ncurses-devel \
readline-devel \
tk-devel \
gcc \
make \
perl
Python3.7 需要 openssl 1.0.2 以上的版本
wget http://www.openssl.org/source/openssl-1.0.2j.tar.gz
tar -xzvf openssl-1.0.2j.tar.gz
cd openssl-1.0.2j
openssl_dir=/usr/local/openssl/openssl-1.0.2j
./config \
shared \
zlib-dynamic \
--prefix=$openssl_dir
make && make install
首先在 python ftp 上下载最新 3.7 源码
wget https://www.python.org/ftp/python/3.7.2/Python-3.7.2.tgz
tar -zxvf Python-3.7.2.tgz
cd Python-3.7.2
python_dir=/usr/local/python/python3.7
openssl_dir=/usr/local/openssl/openssl-1.0.2j
./configure \
--prefix=$python_dir \
--enable-shared \
LDFLAGS="-Wl,--rpath=$python_dir/lib:$openssl_dir/lib" \
--with-openssl=$openssl_dir \
--with-ensurepip=yes
make && make install
ln -s $python_dir/bin/python3.7 /usr/bin/python3.7
ln -s $python_dir/bin/python3.7-config /usr/bin/python3.7-config
ln -s $python_dir/bin/python3.7m /usr/bin/python3.7m
ln -s $python_dir/bin/python3.7m-config /usr/bin/python3.7m-config