解决 the ssl module in Python is not available 的问题

今天在安装 awx 时,碰到 pip 需要升级的提示,遂执行 python3.9 -m pip install --upgrade pip 进行升级,但是升级过程中提示如下报错:

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

出现如下报错的原因,是因为 Python 在编译时,没有使用 ssl 参数,故默认没有安装相关模块,下面是解决办法:

  1. 安装依赖:
yum install -y openssl openssl-devel
  1. 安装 python 模块
./configure --with-ssl-default-suites=openssl --prefix=/usr/local/Python3.9 && make && make install

安装完成后,就可以正常使用了。值得注意的是,很多网上的办法,都是添加 --with-ssl 参数,但是在 3.9.0 上这个参数已经没有了,替换成了 --with-ssl-default-suites 参数。

消息盒子

# 暂无消息 #

只显示最新10条未读和已读信息