1. 程式人生 > >PIP 安裝包 報錯 SSL

PIP 安裝包 報錯 SSL

報錯如下:

D:\acadci-github\wk_client_tools\venv\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

網上說是pypi官網不再支援低版本的ssl協議, 而python2.7.9之前的pip所有的客戶端協議比較舊,所有一直報SSl協議問題, 

可以通過升級pip包解決問題, 但是這個就是egg-hen的問題了.

試了 --trusted-host引數不行,
 

pip --trusted-host pypi.org install virtualenv

試了用國內的http網站, 不知道是防火牆問題還是什麼 也不行. 

最後一氣之下更新了python 版本到2.7.14 解決了這個問題.   

這邊文章解釋了一些更深層的原因, 為什麼ssl協議版本低

http://blog.51cto.com/13544424/2149473?cid=722522(中文的)

這兒還有一個英文的版本, 不過他的解決方案適用於mac,可以幫助我們理解這個問題

https://stackoverflow.com/questions/49748063/pip-install-fails-for-every-package-could-not-find-a-version-that-satisfies/49748494#49748494

這個官方文件也挺有用的:

https://pip.pypa.io/en/stable/installing/#upgrading-pip