在 CentOS 里,Python 可以通过以下几类软件源获取,不同源里的 Python 版本差别很大:
仓库名:base / os
dnf 安装)# CentOS 7
yum list python
# CentOS 8
dnf list python3
仓库名:epel
yum install epel-release
yum install python38
仓库名:centos-release-scl
yum install centos-release-scl
yum install rh-python39
scl enable rh-python39 bash
仓库名:remi
yum install https://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum install python39
仓库名:ius
yum install https://repo.ius.io/ius-release.rpm
yum install python39
| 需求 | 推荐源 |
|---|---|
| 稳定系统 | base / EPEL |
| 多版本共存 | SCL / IUS |
| 最新版本 | Remi |
| 开发测试 | pyenv |
如果你告诉我 CentOS 版本(7/8/Stream) 和 需要的 Python 版本,我可以给你精确命令。