当前位置:   article > 正文

【Linux】pip is configured with locations that require TLS/SSL, however the ssl module in Python is no

pip is configured with locations that require tls/ssl, however the ssl modul

1.问题描述

在linux中安装完 Python.7 后,使用 pip3(Python3.x自带)安装模块时,出现以下异常,导致安装失败:

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

 

2.问题原因

当前行系统没有 openssl 或者版本比较低,一般 python3.7 需要的openssl的版本为1.0.2或者1.1.x。需要对 openssl 进行升级,并重新编译 python3.7.0。

 

3.解决方法

下载openssl
地址:openssl-1.1.1a.tar.gz

创建安装目录
mkdir -p usr/local/openssl

解压
tar -zxvf openssl-1.1.1a.tar.gz

编译安装
cd openssl-1.1.1a
./config --prefix=/usr/local/openssl no-zlib #不需要zlib
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

重新安装python
cd Python-3.7.5
./configure --prefix=/usr/local/python3 --with-openssl=/usr/local/openssl
make
make instal

 

4.最后,成功解决问题,能够使用 pip3 安装模块

 

参考文章:【Python包】pip安装teradatasql时提示没有TLS/SSL模块(含安装Perl步骤)

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/笔触狂放9/article/detail/423635
推荐阅读
相关标签
  

闽ICP备14008679号