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

  • 相关阅读:
    JS基础语法---函数练习part3---4个练习
    JS基础语法---函数练习part2---10个综合练习(运用:循环/数组/函数)
    JS基础语法---函数练习part1---5个练习
    JS基础语法---函数---介绍、定义、函数参数、返回值
    JS基础语法---冒泡顺序
    JS基础语法---数组案例---9个练习
    JS基础语法---for循环遍历数组
    Python小技巧:使用一行命令把你的电脑变成服务器
    目前最全的Python的就业方向
    这十个Python常用库,学习Python的你必须要知道!
  • 原文地址:https://www.cnblogs.com/sea-stream/p/10390441.html
Copyright © 2011-2022 走看看