You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ImportError: urllib3 v2.0 only suports 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
二、解决方法
1、检查 requests 版本:
pip show requests
2、重新安装指定版本的request库
$ pip uninstall requests
$ pip install requests==2.29.0
$ pip show urllib3
Name: urllib3
Version: 1.26.15
Summary: HTTP library with thread-safe connection pooling, file post, and more.
Home-page: https://urllib3.readthedocs.io/
Author: Andrey Petrov
Author-email: [email protected]
License: MIT
Location: /XXX/python3.7/site-packages
Requires:
Required-by: requests
Removed support for OpenSSL versions earlier than 1.1.1 or that don’t have SNI support. When an incompatible OpenSSL version is detected an ImportError is raised (#2168).
删除了对早于 1.1.1 或不支持 SNI 的 OpenSSL 版本的支持。当检测到不兼容的 OpenSSL 版本时,将ImportError引发 ( [#2168](https://github.com/urllib3/urllib3/issues/2168) )。
一、现象
环境:Python 3.7.2
现象:Python文件中引入了requests库,在执行的时候报错如下:
ImportError: urllib3 v2.0 only suports 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
二、解决方法
1、检查 requests 版本:
2、重新安装指定版本的request库
重新安装完成后,问题解决!
三、原理
1、依赖关系:
[requests] --> [urllib3] --> [openssl]
在 Python 3.7.2 下默认安装的requests版本为
2.30.0
,这个版本依赖 urllib3 的v2.0
版本,根据urllib官网的介绍:实际查看,操作系统的OpenSSL版本号:
2、解决思路:
目前采用思路2:根据github描述,requests==2.29.0版本依赖urllib3的
1.21.1~1.27
版本,而urllib3 < v2.0 版本的,是支持openssl低版本的。四、参考链接
The text was updated successfully, but these errors were encountered: