我使用的是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
当前回答
我在使用Ubuntu、pyenv和pyenv管理的Python 3.8.1时遇到了这个问题。实际上没有办法让pip正确工作,因为每次我试图安装任何东西,包括pip本身,都会出现相同的错误。 最终的解决方案是通过pyenv安装一个更新的版本,在本例中是3.8.6。显然,从3.8.4开始,Python已经准备好开箱运行SSL/TLS,所以一切都很好。
其他回答
对于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
对于未来试图解决这个问题的Oracle Linux用户,下面是对我有用的方法。 首先安装缺少的库:
yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel
readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel
然后cd到Python3。X库并运行:
make
make install
我得到了同样的错误:
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模块不可用
最新的Python 3.8.4或更高版本应该能够支持https协议开箱即用。如果你的电脑上仍然安装了旧的python,要么手动下载并安装python3,要么使用Chocolatey:
如果你没有Chocolatey,安装它-从这里:https://chocolatey.org/docs/installation
您只需复制粘贴一个命令行行,并从命令提示符中使用提升的特权执行它。
choco install python3
如果你没有安装python3,或者你已经安装了python3,那么:
choco upgrade python3
还要注意,你也可以使用anaconda发行版,因为它有内置的支持https的python,但这个相当古老的指令,不需要再遵循它们了。
使用命令行安装anaconda:
choco install anaconda3
设置环境变量:
set PATH=C:\tools\Anaconda3\Scripts;C:\tools\Anaconda3;C:\tools\Anaconda3\Library\bin;%PATH%
然后运行失败的命令。我的情况是:
pip install conan
Anaconda使用单独的python安装,pip也是Anaconda特定的。
先安装openssl。
如果你在conda环境中遇到这个问题,你可以安装openssl 使用conda install -c anaconda openssl。它为您启用ssl !