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

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

当前回答

对于Windows 10下的Miniconda3, python=3.7.5,我尝试了以上所有建议;毫无效果。我不得不降级到python=3.7.0,这解决了这个问题

conda install python=3.7.0

显然这很混乱。答案表明升级到3.8.5也可以工作,但这在我的环境中有太多的副作用。

其他回答

问题可能来自您安装的openssl包版本。这就是我的情况,我解决了这个问题,只是升级它。我在Mac OS上,使用brew:

brew upgrade openssl

如果你用brew安装了python,这应该会直接修复这个问题,因为python依赖于openssl

正如Tokci所说,它也适用于Windows 7。

用鼠标移动到Windows图标(左下),并开始输入“Anaconda”。应该会显示一些匹配的条目。选择“Anaconda Prompt”。一个名为“蟒蛇提示”的新命令窗口将打开。

然后pip开始工作。

以下也有助于导入xgboost: https://www.youtube.com/watch?v=05djBSOs1FA

在我的例子中,我重新安装了Python。这就解决了问题。

brew reinstall python

先安装openssl。

如果你在conda环境中遇到这个问题,你可以安装openssl 使用conda install -c anaconda openssl。它为您启用ssl !

对于未来试图解决这个问题的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