zoukankan      html  css  js  c++  java
  • 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

  • 相关阅读:
    继承与多态——动手又动脑
    类与对象--动手又动脑
    Go语言接口
    GO语言结构体
    GO指针
    GO函数
    GO获取随机数
    GO基础
    Go语言的%d,%p,%v等占位符的使用
    GO语言常量和变量
  • 原文地址:https://www.cnblogs.com/sea-stream/p/10390441.html
Copyright © 2011-2022 走看看