Windows Python2.7 openssl: 'SSLError(SSLError(1, '_ssl.c:507: error:1407742E:SSL routines:SSL23...

1.报错信息:

(flaskworkspace) D:\ProgramFiles\flask\flaskworkspace\Scripts>pip install flask
Collecting flask
D:\ProgramFiles\python\lib\site-packages\pip-18.0-py2.7.egg\pip_vendor\urllib3\util\ssl_.
py:369: SNIMissingWarning: An HTTPS request has been made, but the SNI (Server Name Indica
tion) extension to TLS is not available on this platform. This may cause the server to pre
sent 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.readth
edocs.io/en/latest/advanced-usage.html#ssl-warnings
SNIMissingWarning
D:\ProgramFiles\python\lib\site-packages\pip-18.0-py2.7.egg\pip_vendor\urllib3\util\ssl_.
py:160: 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 http
s://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
InsecurePlatformWarning
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after con
nection broken by 'SSLError(SSLError(1, '_ssl.c:507: error:1407742E:SSL routines:SSL23_GET
SERVER_HELLO:tlsv1 alert protocol version'),)': /simple/flask/
D:\ProgramFiles\python\lib\site-packages\pip-18.0-py2.7.egg\pip_vendor\urllib3\util\ssl
.
py:160: 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 http
s://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
InsecurePlatformWarning
Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after con
nection broken by 'SSLError(SSLError(1, '_ssl.c:507: error:1407742E:SSL routines:SSL23_GET
SERVER_HELLO:tlsv1 alert protocol version'),)': /simple/flask/
D:\ProgramFiles\python\lib\site-packages\pip-18.0-py2.7.egg\pip_vendor\urllib3\util\ssl
.
py:160: 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 http
s://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
InsecurePlatformWarning
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after con
nection broken by 'SSLError(SSLError(1, '_ssl.c:507: error:1407742E:SSL routines:SSL23_GET
SERVER_HELLO:tlsv1 alert protocol version'),)': /simple/flask/
D:\ProgramFiles\python\lib\site-packages\pip-18.0-py2.7.egg\pip_vendor\urllib3\util\ssl
.
py:160: 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 http
s://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
InsecurePlatformWarning
Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after con
nection broken by 'SSLError(SSLError(1, '_ssl.c:507: error:1407742E:SSL routines:SSL23_GET
SERVER_HELLO:tlsv1 alert protocol version'),)': /simple/flask/
D:\ProgramFiles\python\lib\site-packages\pip-18.0-py2.7.egg\pip_vendor\urllib3\util\ssl
.
py:160: 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 http
s://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
InsecurePlatformWarning
Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after con
nection broken by 'SSLError(SSLError(1, '_ssl.c:507: error:1407742E:SSL routines:SSL23_GET
SERVER_HELLO:tlsv1 alert protocol version'),)': /simple/flask/
D:\ProgramFiles\python\lib\site-packages\pip-18.0-py2.7.egg\pip_vendor\urllib3\util\ssl
.
py:160: 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 http
s://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
InsecurePlatformWarning
Could not fetch URL https://pypi.org/simple/flask/: There was a problem confirming the s
sl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with
url: /simple/flask/ (Caused by SSLError(SSLError(1, '_ssl.c:507: error:1407742E:SSL routin
es:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version'),)) - skipping
Could not find a version that satisfies the requirement flask (from versions: )
No matching distribution found for flask

2.可能原因

是因为网络的问题,要使用国内的镜像源来加速

3.解决办法

pip install flask

改为

pip install flask -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com
参考文章

1.关于 pip安装的可能错误的排除

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容