导入库时,我在 python3.10.11 (IDE -PyCharm) 中遇到 ImportError

问题描述 投票:0回答:1

每次我尝试导入请求和其他库时都会出现此错误:

C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\python.exe C:\Users\Administrator\PycharmProjects\pythonProject11\main.py 
Traceback (most recent call last):
  File "C:\Users\Administrator\PycharmProjects\pythonProject11\main.py", line 1, in <module>
    import requests
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\requests\__init__.py", line 43, in <module>
    import urllib3
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\__init__.py", line 42, in <module>
    "urllib3 v2.0 only supports OpenSSL 1.1.1+, currently "
ImportError: urllib3 v2.0 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with 'OpenSSL 1.1.0h  27 Mar 2018'. See: https://github.com/urllib3/urllib3/issues/2168

我是编码新手,去了 stackoverflow,但大多数解决方案都不起作用!

python ssl pycharm openssl urllib3
1个回答
0
投票

该错误表明最新版本的urllib3仅支持OpenSSL版本,1.1.1+。试试这个

pip uninstall urllib3
pip install urllib3==1.26.16

发布历史
https://pypi.org/project/urllib3/1.26.16/#history

© www.soinside.com 2019 - 2024. All rights reserved.