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
最终执行自动化脚本成功!