python3.7安装

用python3.7.4安装,老是会报关于ssl的错误,但是用3.7.5就不会,很神奇!!

安装依赖

yum install -y zlib zlib-dev openssl-devel sqlite-devel bzip2-devel libffi libffi-devel gcc gcc-c++

安装最新的openssl

wget https://www.openssl.org/source/openssl-1.0.2t.tar.gz
tar -xzvf openssl-1.0.2t.tar.gz
cd openssl-1.0.2t/
./config --prefix=/usr/local/openssl shared zlib
make && make install
# 加入系统环境变量
echo "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/openssl/lib" >> $HOME/.bash_profile
source $HOME/.bash_profile

安装python 3.7.5

 wget https://www.python.org/ftp/python/3.7.5/Python-3.7.5.tar.xz
 tar -xJvf Python-3.7.5.tar.xz
 cd Python-3.7.5/
 ./configure --prefix=/usr/local/python37 --with-openssl=/usr/local/openssl
 make && make install
 ln -s /usr/local/python37/bin/python3.7 /usr/local/bin/python3.7
 ln -s /usr/local/python37/bin/pip3.7 /usr/local/bin/pip3.7

你可能感兴趣的:(linux,python)