在 CentOS 上使用 pip 安装软件包时出现问题(SSLError)

问题描述 投票:0回答:1

我使用的是centos 7.6.1810

我已经下载了Python的这些依赖项

yum install openssl-devel bzip2-devel libffi-devel
yum groupinstall "Development Tools"

然后我下载python3.10.9

sudo wget https://www.python.org/ftp/python/3.10.9/Python-3.10.9.tgz

解压后我尝试进行安装步骤

./configure --enable-optimizations
sudo make altinstall

安装步骤完成得很快,当我尝试使用 pip 时,出现以下错误

Package    Version
---------- -------
pip        22.3.1
setuptools 65.5.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
WARNING: There was an error checking the latest version of pip.

我认为这可以通过下载 openssl 依赖项来解决

有谁知道我的问题是什么或如何解决?

python ssl pip openssl centos
1个回答
0
投票

如果我按照你的问题中概述的步骤操作,那么在构建 Python 时我会看到错误:

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

这就是我在评论中所建议的。您需要安装较新版本的 openssl 库才能构建支持 ssl 的 Python。

或者,您可以考虑使用

podman
(或
docker
)运行容器化 Python 来获取更新版本,而无需构建任何内容。

© www.soinside.com 2019 - 2024. All rights reserved.