由于SSL证书TLSv1.0,点子失败 [英] pip fails due to SSL cert TLSv1.0

查看:313
本文介绍了由于SSL证书TLSv1.0,点子失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为另一个pip问题表示歉意,但是我几乎尝试了所有其他线程,但到目前为止没有任何效果. 所以我遇到的问题是,由于使用TLSv1.0,pip无法安装任何软件包 Could not fetch URL https://pypi.python.org/simple/pip/: There was a problem confirming the ssl certificate: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:661) - skipping

Apologies for another pip issue, but I've tried almost every other thread and nothing so far works. So I am having the issue that pip doesn't install any package due to using TLSv1.0 Could not fetch URL https://pypi.python.org/simple/pip/: There was a problem confirming the ssl certificate: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:661) - skipping

我已经完成了卷曲操作,下载了get_pip.py脚本,然后使用sudo python执行了它.

I have done the curl to download the get_pip.py script then executed it with sudo python.

我尝试手动下载pip.tar.gz,解压缩并通过pip install ./pip.10.0.3

I have tried downloading the pip.tar.gz manually, extracting it and installing via pip install ./pip.10.0.3

安装后,我已经完成了pip install --upgrade setuptools

Once installed, I have done pip install --upgrade setuptools

我已经通过Homebrew安装了python.

I have installed python via Homebrew.

pip --version pip 10.0.1 from /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip (python 2.7)

pip --version pip 10.0.1 from /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip (python 2.7)

但是,每次尝试安装软件包时,每次仍然出现此TLSv1错误,并显示我正在使用TLS1.0

However every time I still get this TLSv1 error when attempting to install a package, and it shows I have TLS1.0 in use

python2 -c "import urllib2,json; print(json.loads(urllib2.urlopen('https://www.howsmyssl.com/a/check').read())['tls_version'])" TLS 1.0

python2 -c "import urllib2,json; print(json.loads(urllib2.urlopen('https://www.howsmyssl.com/a/check').read())['tls_version'])" TLS 1.0

运行OSX 10.13.4

Running OSX 10.13.4

python2 -c "import ssl; print(ssl.OPENSSL_VERSION)" OpenSSL 0.9.8zh 14 Jan 2016

python2 -c "import ssl; print(ssl.OPENSSL_VERSION)" OpenSSL 0.9.8zh 14 Jan 2016

$ brew upgrade openssl Error: openssl 1.0.2o_2 already installed

$ brew upgrade openssl Error: openssl 1.0.2o_2 already installed

跟随这里的话题,最高的答案,并最终成功 引用旧SSL版本的Python

Followed the thread here, the topmost answer and eventually worked Python referencing old SSL version

$ python -c "import ssl; print ssl.OPENSSL_VERSION" OpenSSL 1.0.2o 27 Mar 2018

$ python -c "import ssl; print ssl.OPENSSL_VERSION" OpenSSL 1.0.2o 27 Mar 2018

推荐答案

$ brew upgrade openssl
Error: openssl 1.0.2o_2 already installed

这表明您的系统上确实安装了更新版本的openssl.

This shows that a newer version of openssl is indeed installed on your system.

python2 -c "import ssl; print(ssl.OPENSSL_VERSION)"
OpenSSL 0.9.8zh 14 Jan 2016

但这表明Python的ssl模块是针对旧版本编译的.

But this shows that Python's ssl module was compiled against an older version.

我不熟悉Homebrew,但根据关于Homebrew的此问题在Github页面上,Homebrew现在默认使用其自己的openssl版本.

I am unfamiliar with Homebrew, but according to this issue on Homebrew's Github page, Homebrew now uses its own version of openssl by default.

基于此,解决此问题的完整步骤将是:

Based on this, the full steps to fix this issue would be:

brew uninstall python2
brew update
brew upgrade openssl
brew install python2

这篇关于由于SSL证书TLSv1.0,点子失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆