CentOS 7.7 和 Python

CentOS 7.7 和 Python

我读到 CentOS 7.7 将 Python 升级到版本 3.6CentOS Linux 7.7 发布,更新方法如下

谁能解释一下为什么在我的 Centos 7.7 服务器中我有 Python 2.7.5,它是 EOL 而不是 Python 3.6,并且 yum 不提供升级到 Python 3.6 的可能性?

[root@cpanel ~]# hostnamectl
   Static hostname: hidden(myserver hostname)
         Icon name: computer-server
           Chassis: server
        Machine ID: ade4e1c7a3534397a3f75bdf9eee8e4d
           Boot ID: 6870183871774c68a23a0c04230d1408
  Operating System: CentOS Linux 7 (Core)
       CPE OS Name: cpe:/o:centos:centos:7
            Kernel: Linux 3.10.0-514.26.2.el7.x86_64
      Architecture: x86-64

-

[root@cpanel ~]# cat /etc/os-release
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

-

[root@cpanel ~]# python -V
Python 2.7.5

-

# cat /etc/yum.conf 
[main]
exclude=courier* dovecot* exim* filesystem httpd* mod_ssl* mydns* nsd* p0f php* proftpd* pure-ftpd* spamassassin* squirrelmail*
tolerant=1
errorlevel=1
cachedir=/var/cache/yum/$basearch/$releasever
keepcache=0
debuglevel=2
logfile=/var/log/yum.log
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
installonly_limit=5
bugtracker_url=http://bugs.centos.org/set_project.php?project_id=23&ref=http://bugs.centos.org/bug_report_page.php?category=yum
distroverpkg=centos-release

-

[root@cpanel ~]# yum upgrade python
Loaded plugins: fastestmirror, universal-hooks
Loading mirror speeds from cached hostfile
 * EA4: 104.254.183.20
 * cpanel-addons-production-feed: 104.254.183.20
 * cpanel-plugins: 104.254.183.20
 * base: mirror.tzulo.com
 * epel: mirror.steadfastnet.com
 * extras: mirror.den01.meanservers.net
 * updates: mirror.sesp.northwestern.edu
No packages marked for update

答案1

Python 3 在软件包中可用python3

yum install python3

解释器仍然python3python运行 Python 2 解释器。

Python 2 已被 PSF 宣布 EOL,但是红帽仍然在 RHEL 中提供对 Python 2 的支持,CentOS 应该继续受益于这种支持。

答案2

来自 CentOS 的 Python 2.7.5 实际上并不是 EOL,因为 CentOS 将在 CentOS 7 的整个生命周期中支持它。Red Hat Enterprise Linux 7 附带的 Python 2.7.5 也是如此。

如果你想获得 Python 3,那么你可以使用以下命令安装它:

yum install python3

您还可以从 CentOS Software Collections Repo 获取它:

yum install centos-release-scl

然后,您可以使用以下命令安装 Python 3 至 3.6 的任何颠覆版本:

yum install rh-python33
yum install rh-python34
yum install rh-python35
yum install rh-python36

相关内容