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

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

转载于:https://www.cnblogs.com/khstudy/p/11102633.html

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

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

    python3.7安装, 解决pip is configured with locations that require TLS/SSL问题 1.安装相关依赖 yum install gcc libf ...

  2. 解决pip is configured with locations that require TLS/SSL问题

    解决pip is configured with locations that require TLS/SSL问题 参考文章: (1)解决pip is configured with location ...

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

    1.安装相关依赖 yum install gcc libffi-devel zlib* openssl-devel # libffi-devel zlib-devel bzip2-devel open ...

  4. python3 pip 报错 pip is configured with locations that require TLS/SSL

    python3 pip 安装时报错: pip is configured with locations that require TLS/SSL, however the ssl module in ...

  5. pip is configured with locations that require TLS/SSL 解决

    pip安装numpy时报错: pip is configured with locations that require TLS/SSL 解决方法 其实还是 Anaconda 环境变量的问题. 进入  ...

  6. 「Python-Bug」pip is configured with locations that require TLS/SSL

    背景 系统:Ubuntu 18.04 从Python官网下载了Python3.6.8的安装包,根据官网的安装步骤,装完后,直接在终端sudo apt-get install python3-pip,安 ...

  7. pip is configured with locations that require TLS/SSL, however the ssl module in Python is not avail

    linux环境下 首先明确问题出现原因,是因为openssl版本过低或者不存在 so: 查看openssl安装包,发现缺少openssl-devel包  [root@localhost ~]# rpm ...

  8. pip is configured with locations that require TLS/SSL, however the ssl module in Python is not avai

    安装个新的python,结果pip一直不能用,不能联网,是因为python安装的时候,没有安装ssl模块 这个模块对应的软件是openssl 要求版本比较特殊 Could not build the ...

  9. pip is configured with locations that require TLS/SSL

    问题描述 参考链接:https://blog.csdn.net/u012206617/article/details/106494990 解决方案 https://slproweb.com/produ ...

最新文章

  1. 我的Java开发学习之旅------Base64的编码思想以及Java实现
  2. Oracle逻辑空间管理
  3. SAP CRM里Lead通过工作流自动创建Opportunity的原理讲解
  4. 总结1:Ajax上传图片至阿里云服务器
  5. 产品经理实战:电商平台是如何扣库存的?
  6. 100米队伍,从队伍后到前_我们的队伍
  7. java学习(25):三目运算符
  8. 互联网日报 | 5月3日 星期一 | 京东物流通过港交所上市聆讯;理想汽车累计交付破5万辆;拼多多年活跃商户达860万
  9. [java理论篇]--java的面向对象
  10. android service 样例(电话录音和获取系统当前时间)
  11. MySQL数据库基本用法-查询
  12. 使用python模拟实现PID控制算法
  13. 三对角矩阵与追赶法介绍
  14. 积分商城系统架构图_积分商城系统设计_OctShop
  15. 8237A DMA控制器简答
  16. 智安网络详解:零信任网络访问 (ZTNA)原理
  17. 简述计算机视觉中的单眼线索,知觉-心理学文章-壹心理
  18. java 传感器_JAVA串口采集传感器数据
  19. 黑白图转RGB(Matlab)
  20. Google官方Activity介绍

热门文章

  1. 第1章 程序设计和C语言
  2. spring boot——MockMvc的用法 (SpringBoot 1.5.18)下测试通过
  3. Oracle 获取月初和月末
  4. Linux下无需按下回车(无阻塞)读取输入键值
  5. 最短路径 | 1087 三重标尺+记录最短路径条数
  6. Alpha(9/10)
  7. java中初始化块、静态初始化块和构造方法
  8. (转)linux获取/查看本机出口ip
  9. 不定高宽的元素居中的方法
  10. How to Leak a Context: Handlers Inner Classes