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 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
python3.7安装, 解决pip is configured with locations that require TLS/SSL问题的更多相关文章
- 解决pip is configured with locations that require TLS/SSL问题
python3.7安装, 解决pip is configured with locations that require TLS/SSL问题1.安装相关依赖 yum install gcc libff ...
- pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
# 背景 安装pip后发现执行pip install pytest,提示下面错误 pip is configured with locations that require TLS/SSL, howe ...
- pip install 时报错 pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
pip install 时报错: pip is configured with locations that require TLS/SSL, however the ssl module in Py ...
- 编译安装Python出现“pip is configured with locations that require TLS/SSL, however the ssl.....”
ubuntu: sudo apt-get install libssl-dev Cenos: sudo yum install openssl-devel 重新编译: ./configure --en ...
- python3.7.2 pip 出现locations that require TLS/SSL异常处理方法
centos7安装python3.7.2后,运行 pip3 install tornado 会报错 [root@localhost ~]# pip3 install tornado pip is co ...
- python pip 出现locations that require TLS/SSL异常处理方法
python pip 出现locations that require TLS/SSL异常处理方法 转载 郑才华 发布于2018-03-24 21:41:16 阅读数 51844 收藏 展开 最近在r ...
- python3.6 pip 出现locations that require TLS/SSL异常解决方案
在给CentOS服务器安装完Python3.6后,使用pip命令出现问题,提示说无法找到ssl模块. 上网查询后发现在安装Python3.6时没有安装openssl-devel依赖库,解决方案如下: ...
- python3之安装、pip、setuptools
1.python3安装 下载地址:https://www.python.org/ftp/python/3.6.5/Python-3.6.5.tgz #安装环境centOS 7 #安装依赖包: yum ...
- python3自动安装脚本,python3.x与python2.x共存
1.前言: python3过程中,通过搜索一些文章参考安装过程发现比较麻烦,而且还出现一些不可预期的报错.python3环境需要升级openssl,所以为了部署到其他环境更方便,写自动安装脚本方式,且 ...
随机推荐
- ASP.NET Core身份验证
asp.net core 身份验证 本文旨在演示如果使用内置的 identity 实现 asp.net core 的身份验证,不会进行其它扩展.本文将通过最简单的代码演示如何进行登录和身份验证操作. ...
- mac-安装sshpass
在配置了ssh免密认证id_rsa.pub之后,在cmd终端可以实现免密登陆对应配置了密钥的服务器,但是在python程序中,想要调用cmd执行免密操作,还需要安装sshpass,sshpass用于非 ...
- Android进程管理机制研究
一.Linux中的进程管理在Linux中,进程是指处理器上执行的一个实例,可使用任意资源以便完成它的任务,具体的进程管理,是通过“进程描述符”来完成的,对应Linux内核中的task_struct数据 ...
- 第1章:C++泛型技术基础:模板——《C++泛型:STL原理和应用》读书笔记整理
第1章:C++泛型技术基础:模板 1.2 关于模板参数 1.2.1 模板参数类型 类型参数 typename声明的参数都属于类型参数,它的实参必须为系统内置或者用户自定义的数据类型,包括类模板实体 ...
- Java之Hashmap中value为null,则返回json数据中key不存在
前两天干活儿的时候,将实例对象放在Hashmap中返回给前端: ArtificialEntity artificialEntity = artificialService.getInfoById(id ...
- IT兄弟连 HTML5教程 CSS3属性特效 文字排版
direction定义文字排列方式,所有浏览器都兼容这个属性,有两个可选值rtl和ltr.文字排版的参数说明如表1所示. 表1 CSS3文字排版参数说明 上表所示,ltr是初始值,表示left-to ...
- Jmeter录制后的脚本调优
当我们通过badboy或者HTTP代理服务器的方式录制的脚本,会发现脚本杂乱无章,图片.css.html以及各种我们不关心的脚本,因此就需要针对录制后的脚本进行调优 1.去除图片.html/css等不 ...
- Prometheus监控(二)
Prometheus监控(二) 数据类型 Counter(计数器类型) Counter类型的指标的工作方式和计数器一样,只增不减(除非系统发生了重置),Counter一般用于累计值. Gauges(仪 ...
- Java 入土之路
概述 变量与数据类型 运算符与方法 面向对象 异常处理 包装类与常量池 集合框架 多线程 网络通讯协议 socket 编程-概念未发布 socket 编程-java环境未发布 web入门 Servle ...
- Android Studio 第一个Android项目
创建步骤 Start a new Android Studio project 选择 Empty Activity 设置Android项目的名称.位置,开发语言 打开初始界面 初步认识Androi ...