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

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

当前回答

Windows 10, Windows 7 如果pip install在CMD提示符下不工作,使用Anaconda提示符运行它-它工作。

https://github.com/pypa/virtualenv/issues/1139

其他回答

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

sudo pacman -S openssl

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

pip install openpyxl

这就是默认ssl设置的问题。你需要下载Python3并将路径添加到你的系统中。如果使用Pycharm,请将解释器设置为python3路径。然后可以正常使用pip3而不会出现错误。

进入Anaconda提示符并输入(如果你有python3。X安装在你的引擎上):

py -m pip install pymysql 

我也有同样的问题,这个解决了我的问题。之后,您可以在power shell或任何其他提示符中导入pymysql。

我得到了同样的错误:

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

与上述解决方案类似,使用pyenv重新安装python版本。

不知何故,我升级了我的openssl,它破坏了pyenv版本的python。

pyenv install 3.6.8
python-build: use openssl@1.1 from homebrew
python-build: use readline from homebrew
...

第一行说它依赖于自制的openssl。