pip is configured with locations that require TLS/SSL问题

linux 6 安装python3.7后,使用pip命令出现问题,提示找不到ssl模块,出现错误如下

# pip list
Package Version
---------- -------
pip 10.0.1
setuptools 39.0.1
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

pip版本

# pip --version
pip 10.0.1 from /usr/local/python3/lib/python3.7/site-packages/pip (python 3.7)
# pip list
Package    Version
---------- -------
pip        10.0.1
setuptools 39.0.1
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

经百度查询,系统centos6.5后,其中openssl的版本为

# openssl version
OpenSSL 1.0.1e-fips 11 Feb 2013

而python3.7需要的openssl的版本为1.0.2或者1.1.x,需要对openssl进行升级,并重新编译python3.7.0。yum 安装的openssl 版本都比较低。

升级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
# ./config --prefix=/usr/local/openssl no-zlib
Operating system: x86_64-whatever-linux2
Configuring OpenSSL version 1.1.1a (0x1010101fL) for linux-x86_64
Using os-specific seed configuration
Creating configdata.pm
Creating Makefile

**********************************************************************
***                                                                ***
***   OpenSSL has been successfully configured                     ***
***                                                                ***
***   If you encounter a problem while building, please open an    ***
***   issue on GitHub <https://github.com/openssl/openssl/issues>  ***
***   and include the output from the following command:           ***
***                                                                ***
***       perl configdata.pm --dump                                ***
***                                                                ***
***   (If you are new to OpenSSL, you might want to consult the    ***
***   ‘Troubleshooting‘ section in the INSTALL file first)         ***
***                                                                ***
**********************************************************************
[[email protected] openssl-1.1.1a]# echo $?
0
# make && make install

备份原配置文件

# mv /usr/bin/openssl /usr/bin/openssl.bak
# mv /usr/include/openssl/ /usr/include/openssl.bak

新版设置

# 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

修改系统配置,写入openssl库文件的搜索路径

# echo ‘/usr/local/openssl/lib‘ >> /etc/ld.so.conf

使修改后的/etc/ld.so.conf生效

# ldconfig -v

查看版本

# openssl version
OpenSSL 1.1.1a  20 Nov 2018

需要重新编译安装python

# ./configure --prefix=/usr/local/python3 --with-openssl=/usr/local/openssl
...
# make && make install

再次使用pip

# pip list
Package    Version
---------- -------
pip        10.0.1
setuptools 39.0.1
You are using pip version 10.0.1, however version 19.3.1 is available.
You should consider upgrading via the ‘pip install --upgrade pip‘ command.

升级pip

# pip install --upgrade pip
Collecting pip
  Downloading https://files.pythonhosted.org/packages/00/b6/9cfa56b4081ad13874b0c6f96af8ce16cfbc1cb06bedf8e9164ce5551ec1/pip-19.3.1-py2.py3-none-any.whl (1.4MB)
    100% |████████████████████████████████| 1.4MB 13kB/s
Installing collected packages: pip
  Found existing installation: pip 10.0.1
    Uninstalling pip-10.0.1:
      Successfully uninstalled pip-10.0.1
Successfully installed pip-19.3.1

尝试pip安装

# pip install matplotlib
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘ReadTimeoutError("HTTPSConnectionPool(host=‘pypi.org‘, port=443): Read timed out. (read timeout=15)")‘: /simple/matplotlib/
Collecting matplotlib
  Downloading https://files.pythonhosted.org/packages/61/42/3e92d7aa64295483fbca20a86c89b34d0cb43cffaadaffe028793902d790/matplotlib-3.1.2-cp37-cp37m-manylinux1_x86_64.whl (13.1MB)
     |                                | 30kB 4.9kB/s eta 0:44:56ERROR: Exception:
Traceback (most recent call last):
  File "/usr/local/python3/lib/python3.7/site-packages/pip/_vendor/urllib3/response.py", line 425, in _error_catcher

可以下载安装,只是我的网络不行,下载不了。。

原文地址:https://www.cnblogs.com/zwj-linux/p/12057009.html

时间: 2024-10-30 04:28:15

pip is configured with locations that require TLS/SSL问题的相关文章

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, however the ssl module in Python is not available. # 解决方法 查询了资料,大概意思是,新版的pip默认要使用SSL,可以通过设置修改,但木有发现pip.conf文件在哪里,囧rz,后续再研究下 但找到另外一个解决方法 先安装openssl-dev,然后重

pip is configured with locations that require TLS/SSL, however the ssl module in Python is not 解决方法

pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available 解决方法 问题 今天在安装 Pygame 的时候,发现照着之前自己写的教程出现了问题. pip is configured with locations that require TLS/SSL, however the ssl module in Python is not availa

pip 出现locations that require TLS/SSL

最近在redhat 7上安装Python3.6.4之后,使用pip命令出现了问题,提示说找不到ssl模块,出现错误如下: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available. Could not fetch URL https:*******: There was a problem confirming the ssl certifica

网络安全——传输层安全协议(Transport Layer Security) TLS/SSL

网络安全——传输层安全协议(Transport Layer Security) TLS/SSL 1. 综述 TLS/SSL用于认证和加密. TLS/SSL的核心在于公钥和私钥,公钥在安全证书中. 公钥和私钥成对出现,通信个体的公钥公开,私钥则严格保密,只有自己知道:有下面的特性: 1. 公钥加密的数据只能由私钥解密: 2. 私钥加密的数据只能由公钥解密. A用私钥加密后,其他人尝试用A的公钥解密可以判断是否是A发出的数据:发给A的数据用A的公钥加密,则只有A能读取. 2. 对称密码和非对称密码

使用sslsplit嗅探tls/ssl连接

我最近演示了如何使用mitmproxty执行中间人攻击HTTP(S)连接.当mitmproxy工作支持基于HTTP的通信,它不了解其他基于基于TLS/SSL的流量,比如FTPS,通过SSL的SMTP,通过SSL的IMAP或者其他一些覆盖TLS/SSL的协议. SSLsplit是一般的通过所有安全通信协议来进行中间人攻击TLS/SSL代理.使用SSLsplit可以拦截保存基于SSL流量,从而监听任何安全连接. 1.工作原理 SSLsplit和其他SSL代理工具十分相似:它可以作为客户端和服务器之间

非对称加密,数字签名,公钥私钥,Openssl,https,TLS/SSL等概念说明

本文将通过个人口吻介绍有关公钥私钥,Openssl,https,TLS/SSL等的一些概念及简单配置,在目前时间点(2017年5月7号)下,个人水平有限,存在不少知识理解不够深入,望见谅,后续有新的收获之后将会补充完善该博文. 关于http以及web等基础概念,欢迎看我的另一篇博文:"http,https,www,web等的区别含义" 博文链接地址:http://watchmen.blog.51cto.com/6091957/1922919 本文参考文献引用链接: 1.https://

Liunx 部署邮件TLS/SSL加密通信服务

部署邮件TLS/SSL加密通信服务 一.部署普通邮件服务器 1) 搭建并检测邮件服务的发送服务 [[email protected] ~]# rpm -q postfix postfix-2.10.1-6.el7.x86_64 [[email protected] ~]# netstat -pantu | grep :25 tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      1822/ma

Security基础(三):OpenSSL及证书服务、邮件TLS/SSL加密通信

一.OpenSSL及证书服务 目标: 本案例要求熟悉OpenSSL工具的基本使用,完成以下任务操作: 使用OpenSSL加密/解密文件 搭建企业自有的CA服务器,为颁发数字证书提供基础环境 方案: 使用两台RHEL7虚拟机,其中svr7作为CA数字证书服务器,而pc207作为测试用客户机. 步骤: 步骤一:使用OpenSSL加密/解密文件 1)加密文件 创建一个明文的文本文件f1.txt,使用openssl进行加密,选用des3加密算法,输出的加密文件为f1.txt.enc . [[email 

邮件TLS/SSL加密通信

案例1:邮件TLS/SSL加密通信 1 案例1:邮件TLS/SSL加密通信1.1 问题 本案例要求为基于Postfix+Dovecot的邮件服务器提供加密通信支持,主要完成以下任务操作: 为SMTP服务(postfix)添加TLS/SSL加密通信支持 基于dovecot配置POP3s+IMAPS加密通信支持 客户端收发信测试,确保加密的邮件通信可用 1.2 方案 使用两台RHEL7虚拟机,其中svr7作为CA服务器,而mail作为测试用的Postfix+Dovecot邮件服务器.另外可准备一台p