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

时间:2022-05-06
本文章向大家介绍pip is configured with locations that require TLS/SSL, however the ssl module in Python is not avail,主要内容包括# 背景、# 解决方法、基本概念、基础应用、原理机制和需要注意的事项等,并结合实例形式分析了其使用技巧,希望通过本文能帮助到大家理解应用这部分内容。

# 背景

安装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,然后重新编译安装,只是在编译的过程中加入 --enable-optimizations

具体如下:

sudo yum install openssl-dev

然后:
./configure --enable-optimizations
make && make install

这样就可以了的 

实际上解决方法挺多的

1. 修改pip.conf

2. 修改安装目录下module下的setup文件

3. 安装openssl后,编译时加上--enable-optimizations