我已经在我的本地机器上成功安装了Python 3.4和Python 3.6,但无法安装带有pip3的包。

当我执行pip3 install <package>时,我得到以下SSL相关错误:

pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Collecting <package>
  Could not fetch URL https://pypi.python.org/simple/<package>/: There was a problem confirming the ssl certificate: Can't connect to HTTPS URL because the SSL module is not available. - skipping
  Could not find a version that satisfies the requirement <package> (from versions: )
No matching distribution found for <package>

如何修复我的Python3。pip install <package>?


当前回答

我做了一些PATH更改,以模仿Anaconda Powershell提示$env:PATH的一部分

C:\Users\merheb\Miniconda3;C:\Users\merheb\Miniconda3\Library\mingw-w64\bin;C:\Users\merheb\Miniconda3\Library\usr\bin;C:\Users\merheb\Miniconda3\Library\bin;C:\Users\merheb\Miniconda3\Scripts;C:\Users\merheb\Miniconda3\bin;C:\Users\merheb\Miniconda3\condabin;

这招对我很管用。

其他回答

在macos上,使用下面的命令配置python 3.8.1将解决这个问题,我认为它也适用于Linux。

./configure --enable-optimizations --with-openssl=/usr/local/opt/openssl@1.1/

根据您的系统更改dir参数。

同意mastaBlasta的回答。为我工作。我遇到了与主题描述相同的问题。

环境:MacOS Sierra。我用的是自制啤酒。

我的解决方案:

重新安装openssl安装openssl 根据Homebrew提供的提示,执行以下操作: echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profile . bat 出口LDFLAGS =“- l / usr /地方/ opt / openssl / lib” 出口CPPFLAGS = " - i / usr /地方/ opt / openssl /包括“

特穆克斯

这是因为我没有安装现有的openssl版本。

pkg install openssl-tool

我在windows 10上遇到了同样的问题。我非常具体的问题是由于我安装了Anaconda。我安装了Anaconda,在path /to/Anaconda3/的路径下,出现了python.exe。因此,我根本没有安装python,因为Anaconda包含了python。当使用pip安装包时,我发现同样的错误报告,pip配置了需要TLS/SSL的位置,但是Python中的SSL模块不可用。

解决方案如下:

1)可以在官网重新下载python;

2)进入“Python 3.7 (64-bit).lnk”所在目录

3)导入SSL并退出()

4)键入cmd, "Python 3.7 (64-bit).lnk" -m pip install tensorflow为例。

给,你都准备好了。

我做了一些PATH更改,以模仿Anaconda Powershell提示$env:PATH的一部分

C:\Users\merheb\Miniconda3;C:\Users\merheb\Miniconda3\Library\mingw-w64\bin;C:\Users\merheb\Miniconda3\Library\usr\bin;C:\Users\merheb\Miniconda3\Library\bin;C:\Users\merheb\Miniconda3\Scripts;C:\Users\merheb\Miniconda3\bin;C:\Users\merheb\Miniconda3\condabin;

这招对我很管用。