CentOS升级Python3_With_OpenSSL
0x00 升级OpenSSL
0x01 安装Python3
从https://www.python.org/ftp/python/选择所需版本,如3.8.0
cd /usr/local/src
wget https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tar.xz
tar xf Python-3.8.0.tar.xz
cd Python-3.8.0
编辑
Modules/Setup
文件,解开SSL相关注释,并配置OpenSSL路径
SSL=/usr/local/openssl
_ssl _ssl.c \
-DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
-L$(SSL)/lib -lssl -lcrypto
./configure --prefix=/usr/local/python3
make && make install
0x02 替换新版Python
mv /usr/bin/python /usr/bin/python.bak
ln -sf /usr/local/python3/bin/python3 /usr/bin/python
ln -sf /usr/local/python3/bin/pip3 /usr/bin/pip
0x03 测试
python
Python 3.8.0 (default, Aug 12 2022, 10:41:43)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ssl
# 无报错即安装成功