欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Centos7 install Python3.7.3

程序员文章站 2024-03-08 10:50:04
...

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

 

相关标签: python3.7