我使用的是Python 3.6。当我尝试使用pip3安装“模块”时,我遇到了这个问题:

pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available

当前回答

我得到了同样的错误:

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模块不可用

其他回答

如果有人使用Arch Linux操作系统,我通过运行这个解决了TLS/SSL问题:

sudo pacman -S openssl

然后我可以使用pip来安装我需要的包:

pip install openpyxl

对于Debian用户,以下可能会用到:

 sudo apt install libssl-dev libncurses5-dev libsqlite3-dev libreadline-dev libtk8.6 libgdm-dev libdb4o-cil-dev libpcap-dev

然后cd到Python 3. exe文件所在的文件夹。X库源代码,运行:

./configure
make
make install

此问题是由于您的PC上缺少OpenSSL包。

如果pip install openpyxl也给出错误。

你可以通过以下站点安装OpenSSL(Win64 OpenSSL v1.1.1g)来解决这个问题:

slproweb.com/products/Win32OpenSSL.html

重新启动您正在使用的IDE,使更改生效。

如果您已经通过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

我遇到了这个问题!我不小心安装了32位版本的Miniconda3。确保你选择的是64位版本!