pip install报错"Can't connect to HTTPS URL because the SSL module is not available"

发布时间 2023-11-25 17:09:22作者: wh459086748

pip时install报错

一、故障现象

[root@jenkins /data/package/openssl-1.1.1n]# pip3 install emoji
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
WARNING: 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/emoji/
WARNING: 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/emoji/
WARNING: 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/emoji/
WARNING: 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/emoji/
WARNING: 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/emoji/
Could not fetch URL https://pypi.org/simple/emoji/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/emoji/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
ERROR: Could not find a version that satisfies the requirement emoji (from versions: none)
ERROR: No matching distribution found for emoji
WARNING: 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时install报错Can't connect to HTTPS URL because the SSL module is not available

二、解决思路

安装 openssl-1.1.1
下载openssl1.1.1

wget https://www.openssl.org/source/openssl-1.1.1n.tar.gz --no-check-certificate 
解压
tar -zxf openssl-1.1.1n.tar.gz 
进入目录
cd openssl-1.1.1n
设置安装目录 可以自定义 但是要记住,后面会用到
./config--prefix=/data/software/openssl
编译并安装
make -j && make install 


cd /data/package/Python-3.11.5
make  clean
./configure --prefix=/data/software/python3 --with-openssl=/data/software/openssl --with-openssl-rpath=auto
make -j && make install