问题描述

起因是在使用requests包访问https请求时,出现了SSLError,提示Caused by SSLError(“Can’t connect to HTTPS URL because the SSL module is not available.”

根据一些博客设置verify=False,依然无效。

在尝试通过pip指定安装缺少的包时,也出现了类似的提示。

通过pip install 命令安装包时,出现了

Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘SSLError(“Can’t connect to HTTPS URL because the SSL module is not available.”)’: /simple/ssl/

或者对于已安装的版本,提示WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.

有些博客通过使用pip3.x指令(如我安装的是3.8.6版本的python,因此使用pip3.8)执行安装,没起作用。

解决方案

原文地址 https://github/conda/conda/issues/8273

大意是:conda找错了openssl的地址,conda在Anaconda\DLLs目录下寻找openssl的dll文件,但实际上需要的dll在Anaconda3\library\bin目录下。因此只需要将这两个文件复制到 Anaconda\DLLs下即可。

根据提示复制两个dll到指定目录。
D:\Anaconda\Library\bin -> D:\Anaconda\DLLs

不再报错

同时pip也恢复正常。

最后,github NB!

如果这篇文章对你有用,可以点个赞再走哦~~

更多推荐

Can‘t connect to HTTPS URL because the SSL module is not available - 关于anaconda中