1、问题概述?
执行python脚本的时候,使用如下命令
python3 test.py
提示错误:
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
大概得意思就是 urllib3 v2.0需要OpenSSL1.1.1+以上版本,但是及当前的版本低了。
2、解决方案
【首先我们可以通过命令查看当前的版本】
python -c "import ssl; print(ssl.OPENSSL_VERSION)"
当前提示的版本是:1.0.1e-fips.....
【我们可以通过降低urllib3 的版本解决这个问题】
pip3 install urllib3==1.26.15

最终执行自动化脚本成功!
文章讲述了在执行Python脚本时遇到的urllib3v2.0对OpenSSL版本要求高于当前1.0.1e的问题,通过检查ssl版本并降低urllib3至1.26.15解决了该问题,确保了自动化脚本的成功运行。
984

被折叠的 条评论
为什么被折叠?



