升级openssl与python问题

1、下载与安装

wget --no-check-certificate https://www.openssl.org/source/openssl-1.1.1t.tar.gz

tar -zxvf openssl-1.1.1t.tar.gz

cd openssl-1.1.1t/

./config --prefix=/usr/local/ssl

make

sudo make install

2、完成后添加软链接

mv /usr/bin/openssl /usr/bin/oldopenssl

ln -s /usr/local/ssl/bin/openssl /usr/bin/openssl

ln -s /usr/local/ssl/lib/libssl.so.1.1 /usr/lib64/

ln -s /usr/local/ssl/lib/libcrypto.so.1.1 /usr/lib64/

3、验证

openssl version

4、python中报错

Traceback (most recent call last):

File "salt.py", line 1, in <module>

import requests

File "/home/tianqiurong.vendor/.local/lib/python3.8/site-packages/requests/init.py", line 43, in <module>

import urllib3

File "/home/tianqiurong.vendor/.local/lib/python3.8/site-packages/urllib3/init.py", line 42, in <module>

raise ImportError(

ImportError: urllib3 v2 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with 'OpenSSL 1.0.2k-fips 26 Jan 2017'. See: https://github.com/urllib3/urllib3/issues/2168

解决方式如下:

pip install urllib3==1.26.15

小知识

python -c "import ssl; print(ssl.OPENSSL_VERSION)" #查看python中使用的ssl版本

相关推荐
Sinclair3 小时前
简单几步,安卓手机秒变服务器,安装 CMS 程序
android·服务器
木心月转码ing6 小时前
WSL+Cpp开发环境配置
linux
Rockbean1 天前
用40行代码搭建自己的无服务器OCR
服务器·python·deepseek
蝎子莱莱爱打怪1 天前
Centos7中一键安装K8s集群以及Rancher安装记录
运维·后端·kubernetes
茶杯梦轩1 天前
CompletableFuture 在 项目实战 中 创建异步任务 的核心优势及使用场景
服务器·后端·面试
崔小汤呀1 天前
最全的docker安装笔记,包含CentOS和Ubuntu
linux·后端
何中应1 天前
vi编辑器使用
linux·后端·操作系统
何中应1 天前
Linux进程无法被kill
linux·后端·操作系统
何中应1 天前
rm-rf /命令操作介绍
linux·后端·操作系统
何中应1 天前
Linux常用命令
linux·操作系统