栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

python3.10.5安装时openssl安装失败的问题

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

python3.10.5安装时openssl安装失败的问题

初始问题:编译安装python后执行pip list 报错

[root@VM-0-6-centos Python-3.10.5]# pip3 list
Package    Version
---------- -------
pip        22.0.4
setuptools 58.1.0
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
[root@VM-0-6-centos Python-3.10.5]# 

解决办法:
参考链接更新openssl版本:https://blog.csdn.net/tfstone/article/details/109223506,更新版本至3.0.3

更新后,问题依旧存在,检查编译过程,发现编译失败的问题

building '_ssl' extension
gcc -pthread -fPIC -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration -fvisibility=hidden -I./Include/internal -I./Include -I/usr/local/python/python3_10_5/include -I. -I/usr/local/include -I/data/python/Python-3.10.5/Include -I/data/python/Python-3.10.5 -c /data/python/Python-3.10.5/Modules/_ssl.c -o build/temp.linux-x86_64-3.10/data/python/Python-3.10.5/Modules/_ssl.o
gcc -pthread -shared build/temp.linux-x86_64-3.10/data/python/Python-3.10.5/Modules/_ssl.o -L/usr/local/python/python3_10_5/lib -L/usr/local/lib -lssl -lcrypto -o build/lib.linux-x86_64-3.10/_ssl.cpython-310-x86_64-linux-gnu.so
building '_hashlib' extension
gcc -pthread -fPIC -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration -fvisibility=hidden -I./Include/internal -I./Include -I/usr/local/python/python3_10_5/include -I. -I/usr/local/include -I/data/python/Python-3.10.5/Include -I/data/python/Python-3.10.5 -c /data/python/Python-3.10.5/Modules/_hashopenssl.c -o build/temp.linux-x86_64-3.10/data/python/Python-3.10.5/Modules/_hashopenssl.o
gcc -pthread -shared build/temp.linux-x86_64-3.10/data/python/Python-3.10.5/Modules/_hashopenssl.o -L/usr/local/python/python3_10_5/lib -L/usr/local/lib -lssl -lcrypto -o build/lib.linux-x86_64-3.10/_hashlib.cpython-310-x86_64-linux-gnu.so
*** WARNING: renaming "_ssl" since importing it failed: /data/python/Python-3.10.5/build/lib.linux-x86_64-3.10/_ssl.cpython-310-x86_64-linux-gnu.so: undefined symbol: OPENSSL_sk_num
*** WARNING: renaming "_hashlib" since importing it failed: /data/python/Python-3.10.5/build/lib.linux-x86_64-3.10/_hashlib.cpython-310-x86_64-linux-gnu.so: undefined symbol: EVP_MD_get_type

The following modules found by detect_modules() in setup.py, have been
built by the Makefile instead, as configured by the Setup files:
_abc                  pwd                   time               


Following modules built successfully but were removed because they could not be imported:
_hashlib              _ssl                                     


Could not build the ssl module!
Python requires a OpenSSL 1.1.1 or newer

根据报错信息,需要 1.1.1版本以上的openssl,显然条件已经满足,那么应该是旧环境未清理干净所致,严格按照流程重新安装编译

最重要是第10步,指定编译依赖库为新版本openssl相关依赖

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/977488.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号