Centos7 install Python3.7.3

Centos7 install Python3.7.3

1. 下载相关依赖

sudo yum -y install gcc openssl-devel bzip2-devel  libffi-devel

2. 下载python3.7.3安装包

wget --no-check-certificate https://www.python.org/ftp/python/3.7.3/Python-3.7.3.tgz

3. 解压包

tar -xvf Python-3.7.3.tgz

-----------------------------------------------------------------------------------------------------------------------------------------------------------

去掉关于SSL模块的注释

cd Modules

vim Setup.dist

-----------------
# Socket module helper for SSL support; you must comment out the other
# socket line above, and possibly edit the SSL variable:
# SSL=/usr/local/ssl
# _ssl _ssl.c \
#      -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
#      -L$(SSL)/lib -lssl -lcrypto
---------------------

=>
-----------------------
# Socket module helper for SSL support; you must comment out the other
# socket line above, and possibly edit the SSL variable:
# SSL=/usr/local/ssl
 _ssl _ssl.c \
    -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
    -L$(SSL)/lib -lssl -lcrypto
----------------------

-----------------------------------------------------------------------------------------------------------------------------------------------------------

4. 安装

cd Python3.7.3
./configure --enable-optimizations
# make altinstall 避免替换默认的python执行文件
make altinstall

5. 以上

whereis python3
python3 -V
pip3 -V

 

你可能感兴趣的:(kit)