我使用的是Python 3.6。当我尝试使用pip3安装“模块”时,我遇到了这个问题:
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available
我使用的是Python 3.6。当我尝试使用pip3安装“模块”时,我遇到了这个问题:
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available
当前回答
如果您已经通过scoop安装了anaconda,并且在conda环境中使用pip时遇到此错误,您可以通过…
将这些添加到路径中
C:\Users\YOUR_USERNAME\scoop\apps\anaconda3\current
C:\Users\YOUR_USERNAME\scoop\apps\anaconda3\current\Scripts
C:\Users\YOUR_USERNAME\scoop\apps\anaconda3\current\Library
C:\Users\YOUR_USERNAME\scoop\apps\anaconda3\current\Library\bin
通过scoop安装openssl
scoop install openssl
并从..复制以下dll。\anaconda3\Library\bin到..\anaconda3\ dll
引用:
https://stackoverflow.com/a/54897379 https://stackoverflow.com/a/60405693
其他回答
这招对我很管用:
yum install python36-pyOpenSSL
Python版本和包管理器可能不同。
操作系统一样,pyenv
如果你的python是pyenv安装的,其中pyenv是在macOS上安装的,可能有一个更新的版本可以修复这个问题:
$ brew update && brew upgrade pyenv
然后重新安装python版本:
$ pyenv install 3.7.2
pyenv: /Users/luckydonald/.pyenv/versions/3.7.2 already exists
continue with installation? (y/N)
注意,像这样覆盖现有的python安装有点脏,但在我的例子中,它确实有效。可能更干净的方法是删除它,然后正确地重新创建。
我简单地用以下命令解决了这个问题:
Brew升级python@3.9
这个版本默认包含SSL !
我得到了同样的错误:
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
WARNING: 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/pb-tool/
WARNING: Retrying (Retry(total=3, 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/pb-tool/
ERROR: Operation cancelled by user
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
在《Anaconda》中,我使用了以下命令:
conda install anaconda-navigator
本文中提到:pip配置了需要TLS/SSL的位置,但是Python中的SSL模块不可用
对于Windows 10下的Miniconda3, python=3.7.5,我尝试了以上所有建议;毫无效果。我不得不降级到python=3.7.0,这解决了这个问题
conda install python=3.7.0
显然这很混乱。答案表明升级到3.8.5也可以工作,但这在我的环境中有太多的副作用。