我已经在我的本地机器上成功安装了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>?


当前回答

我在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为例。

给,你都准备好了。

其他回答

在Ubuntu中,这可以帮助:

cd Python-3.6.2
./configure --with-ssl
make
sudo make install

降级openssl对我有用,

brew switch openssl 1.0.2s

python文档实际上非常清楚,按照说明做了工作,而我在这里找到的其他答案并没有解决这个问题。

首先,安装python 3.x。例如3.6.2版本https://www.python.org/ftp/python/3.6.2/Python-3.6.2.tar.xz 通过运行brew install openssl,确保已经安装了openssl tar xvzf python -3.6.2.tar。xz && cd Python-3.6.2 然后如果python版本< 3.7,则运行

CPPFLAGS="-I$(brew -prefix openssl)/include" \ LDFLAGS="-L$(brew -prefix openssl)/lib" \ . / configure——with-pydebug 5. 最后,运行make -s -j2 (-s是沉默标志,-j2告诉您的机器使用2个作业)

我在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为例。

给,你都准备好了。

如果你在Windows上使用anaconda,这对我来说是有效的:

我尝试了很多其他的解决方案,但没有工作(环境路径变量变化…)

该问题可能是由其他软件放置在Windows\System32文件夹中的dll(例如libcrypto-1_1-x64.dll或libssl-1_1-x64.dll或其他)引起的。

修复方法是从https://slproweb.com/products/Win32OpenSSL.html安装openSSL,它将dll替换为最新版本。