python3.7.2 pip 出現locations that require TLS/SSL異常處理方法


 

centos7安裝python3.7.2后,運行

pip3 install tornado

會報錯

[root@localhost ~]# pip3 install tornado
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available. Collecting tornado Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/tornado/ Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/tornado/ Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/tornado/ Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/tornado/ Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/tornado/ Could not fetch URL https://pypi.org/simple/tornado/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/tornado/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping Could not find a version that satisfies the requirement tornado (from versions: ) No matching distribution found for tornado pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available. Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping

 

 

解決方法:

在./configure過程中,如果沒有加上–with-ssl參數時,默認安裝的軟件涉及到ssl的功能不可用,
剛好pip3過程需要ssl模塊,而由於沒有指定,所以該功能不可用。

  1. 查看openssl安裝包,發現缺少openssl-devel包 

    [root@localhost ~]# rpm -aq|grep openssl 
    openssl-0.9.8e-20.el5 
    openssl-0.9.8e-20.el5 
    [root@localhost ~]#

     

  2. yum安裝openssl-devel 

    [root@localhost ~]# yum install openssl-devel -y 


    查看安裝結果 

    [root@localhost ~]# rpm -aq|grep openssl 
    openssl-0.9.8e-26.el5_9.1 
    openssl-0.9.8e-26.el5_9.1 
    openssl-devel-0.9.8e-26.el5_9.1 
    openssl-devel-0.9.8e-26.el5_9.1

     

  3. 重新對python3.7.2進行編譯安裝,用以下過程來實現編譯安裝

    cd Python-3.7.2
    ./configure --with-ssl
    make
    sudo make install

 

參考:

https://blog.csdn.net/zhengcaihua0/article/details/79681991


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM