Java自学者论坛

 找回密码
 立即注册

手机号码,快捷登录

恭喜Java自学者论坛(https://www.javazxz.com)已经为数万Java学习者服务超过8年了!积累会员资料超过10000G+
成为本站VIP会员,下载本站10000G+会员资源,会员资料板块,购买链接:点击进入购买VIP会员

JAVA高级面试进阶训练营视频教程

Java架构师系统进阶VIP课程

分布式高可用全栈开发微服务教程Go语言视频零基础入门到精通Java架构师3期(课件+源码)
Java开发全终端实战租房项目视频教程SpringBoot2.X入门到高级使用教程大数据培训第六期全套视频教程深度学习(CNN RNN GAN)算法原理Java亿级流量电商系统视频教程
互联网架构师视频教程年薪50万Spark2.0从入门到精通年薪50万!人工智能学习路线教程年薪50万大数据入门到精通学习路线年薪50万机器学习入门到精通教程
仿小米商城类app和小程序视频教程深度学习数据分析基础到实战最新黑马javaEE2.1就业课程从 0到JVM实战高手教程MySQL入门到精通教程
查看: 553|回复: 0

python3.7安装, 解决pip is configured with locations that require TLS/SSL问题

[复制链接]
  • TA的每日心情
    奋斗
    2024-11-24 15:47
  • 签到天数: 804 天

    [LV.10]以坛为家III

    2053

    主题

    2111

    帖子

    72万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    积分
    726782
    发表于 2021-6-23 09:37:33 | 显示全部楼层 |阅读模式

    1.安装相关依赖

    yum install gcc libffi-devel zlib* openssl-devel
    # libffi-devel zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make


    2.下载并解压
    wget https://www.python.org/ftp/python/3.7.1/Python-3.7.1.tar.xz
    # 下载
    wget https://www.python.org/ftp/python/3.7.1/Python-3.7.1.tar.xz
    # 解压并编译:
    tar -xvJf Python-3.7.1.tar.xz
    cd Python-3.7.1

    3.编译安装
    ./configure prefix=/usr/local/python3
    make && make install
    # 编译完成后,创建软链接文件到执行文件路径:
    ln -s /usr/local/python3/bin/python3 /usr/bin/python3
    ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
    # 我们可以清除之前编译的可执行文件及配置文件 && 清除所有生成的文件:
    make clean && make distclean

    bug: 使用pip 命令失败
    2.1 错误信息
    pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
    Collecting virtualenv
    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/virtualenv/
    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/virtualenv/
    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/virtualenv/
    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/virtualenv/
    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/virtualenv/
    Could not fetch URL https://pypi.org/simple/virtualenv/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/virtualenv/ (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 virtualenv (from versions: )
    No matching distribution found for virtualenv
    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

    2.2 原因
    系统版本centos6.5,其中openssl的版本为OpenSSL 1.0.1e-fips 11 Feb 2013,而python3.7需要的openssl的版本为1.0.2或者1.1.x,需要对openssl进行升级,并重新编译python3.7.0。yum 安装的openssl 版本都比较低。

    2.3 升级openssl
    # 1.下贼openssl
    wget https://www.openssl.org/source/openssl-1.1.1a.tar.gz
    tar -zxvf openssl-1.1.1a.tar.gz
    cd openssl-1.1.1a
    # 2.编译安装
    ./config --prefix=/usr/local/openssl no-zlib #不需要zlib
    make
    make install
    # 3.备份原配置
    mv /usr/bin/openssl /usr/bin/openssl.bak
    mv /usr/include/openssl/ /usr/include/openssl.bak
    # 4.新版配置
    ln -s /usr/local/openssl/include/openssl /usr/include/openssl
    ln -s /usr/local/openssl/lib/libssl.so.1.1 /usr/local/lib64/libssl.so
    ln -s /usr/local/openssl/bin/openssl /usr/bin/openssl
    # 5.修改系统配置
    ## 写入openssl库文件的搜索路径
    echo "/usr/local/openssl/lib" >> /etc/ld.so.conf
    ## 使修改后的/etc/ld.so.conf生效 
    ldconfig -v
    # 6.查看openssl版本
    openssl version

    openssl version 提示:

     /usr/local/openssl/bin/openssl: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory

    假如你的libssl.so.1.1 文件在/usr/local/openssl/lib/下面,可以这样做

    ln -s /usr/local/openssl/lib/libssl.so.1.1 /usr/lib64/libssl.so.1.1

    ln -s /usr/local/openssl/lib/libcrypto.so.1.1 /usr/lib64/libcrypto.so.1.1


    3.3 重新安装python
    ./configure --prefix=/usr/local/python3 --with-openssl=/usr/local/openssl
    make
    make install

     

     


    原文:https://blog.csdn.net/lkgCSDN/article/details/84403329 

    哎...今天够累的,签到来了1...
    回复

    使用道具 举报

    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    QQ|手机版|小黑屋|Java自学者论坛 ( 声明:本站文章及资料整理自互联网,用于Java自学者交流学习使用,对资料版权不负任何法律责任,若有侵权请及时联系客服屏蔽删除 )

    GMT+8, 2024-12-23 02:06 , Processed in 0.060146 second(s), 29 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2021, Tencent Cloud.

    快速回复 返回顶部 返回列表