[Python] pip 執行時,出現 SNIMissingWarning 的錯誤訊息

[Python] pip 執行時,出現 SNIMissingWarning 的錯誤訊息

今天想要用 pip 來安裝 pefile 這個模組,

不過在搜尋時就出現了錯誤訊息,說有 SNIMissingWarning:

testuser@localhost ~ $ pip -v search pefile

Starting new HTTPS connection (1): pypi.python.org
/usr/lib/python2.7/site-packages/pip-8.1.2-py2.7.egg/pip/_vendor/requests/packages/urllib3/util/ssl_.py:318: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present 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.org/en/latest/security.html#snimissingwarning.
SNIMissingWarning
/usr/lib/python2.7/site-packages/pip-8.1.2-py2.7.egg/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: 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.org/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
"POST /pypi HTTP/1.1" 200 None

 

上網查了一下,urllib3: Ceritificate Verification 這篇寫說要安裝 urllib3[secure],

urllib3 才能驗證 HTTPS 的請求:

sudo yum install python-devel
sudo pip install urllib3[secure]

 

安裝好之後,pip 就沒有問題了:

testuser@localhost ~ $ pip -v search pefile
Starting new HTTPS connection (1): pypi.python.org
"POST /pypi HTTP/1.1" 200 None
pefile2 (1.2.11)              - Python PE parsing module
pefile (2016.3.28)            - Python PE parsing module
(本頁面已被瀏覽過 2,119 次)

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *

這個網站採用 Akismet 服務減少垃圾留言。進一步了解 Akismet 如何處理網站訪客的留言資料