温馨提示×

centos哪些源有python

小樊
45
2026-09-27 12:12:09
栏目: 编程语言

在 CentOS 里,Python 可以通过以下几类软件源获取,不同源里的 Python 版本差别很大:


一、CentOS 官方基础源(默认)

仓库名:base / os

  • 包含的 Python:
    • CentOS 7:Python 2.7(系统自带,不可随意卸载)
    • CentOS 8:Python 3.6(通过 dnf 安装)
  • 特点:
    • 稳定、安全
    • 版本较旧
    • 适合系统依赖
# CentOS 7
yum list python

# CentOS 8
dnf list python3

二、EPEL 源(推荐)

仓库名:epel

  • 提供:
    • 更多 Python 工具
    • 部分新版 Python(如 python36、python38)
  • 安装:
yum install epel-release
yum install python38

三、Software Collections(SCL)

仓库名:centos-release-scl

  • 提供:
    • Python 3.6 / 3.8 / 3.9 / 3.11
  • 不影响系统 Python
  • 适合生产环境
yum install centos-release-scl
yum install rh-python39
scl enable rh-python39 bash

四、Remi 源(常用)

仓库名:remi

  • 提供:
    • Python 3.7 ~ 3.12
  • 版本新、更新快
yum install https://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum install python39

五、IUS 源

仓库名:ius

  • 提供:
    • python3x(如 python39, python311)
  • 设计目标:不替换系统 Python
yum install https://repo.ius.io/ius-release.rpm
yum install python39

六、第三方/手动方式

  • 源码编译
  • pyenv
  • 容器(Docker)

推荐选择总结

需求 推荐源
稳定系统 base / EPEL
多版本共存 SCL / IUS
最新版本 Remi
开发测试 pyenv

如果你告诉我 CentOS 版本(7/8/Stream) 和 需要的 Python 版本,我可以给你精确命令。

0 踩