pip not installing any package with warnings “ Ins

2019-06-14 10:42发布

问题:

This question already has an answer here:

  • Not able to install Python packages [SSL: TLSV1_ALERT_PROTOCOL_VERSION] 15 answers

Python version: 2.7.6 Pip version: 9.0.3

C:\Python27\Scripts>pip install pyOpenSSL
Collecting pyOpenSSL

below is the error while installing any package

c:\python27\lib\site-packages\pip_vendor\urllib3\util\ssl_.py:339: SNIMissingWarning: An HTTPS request has been made, b ut the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to pr esent an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings SNIMissingWarning

c:\python27\lib\site-packages\pip_vendor\urllib3\util\ssl_.py:137: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/ latest/advanced-usage.html#ssl-warnings InsecurePlatformWarning Could not find a version that satisfies the requirement certify (from versions: ) No matching distribution found for pyOpenSSL

Tried installing urllib3[secure] --upgrade, but getting the below error along with InsecurePlatformWarning

Could not find a version that satisfies the requirement pyOpenSSL>=0.14; python_version <= "2.7" and extra == "secure" (from urllib3[secure]) (from versions: ) No matching distribution found for pyOpenSSL>=0.14; python_version <= "2.7" and extra == "secure" (from urllib3[secure])

Tried installing the packages suggested in SSL InsecurePlatform error when using Requests package getting the same warning issues.

I cannot upgrade the python version due to some constraints. Any other way to resolve the issue?

回答1:

From python status page:

The rolling brownouts have been upgraded to a blackout, TLSv1.0 and >TLSv1.1 will be rejected with a HTTP 403 at all times.

Posted about 17 hours ago. Apr 08, 2018 - 15:49 UTC

So you need to check what is your TLS version you can do it by running the code:

import json
import urllib2
print json.load(urllib2.urlopen('https://www.howsmyssl.com/a/check'))['tls_version']

If it is less than 1.2 you probably need to upgrade your python version.