5

I have read that CentOS 7.7 upgrades Python to version 3.6 on CentOS Linux 7.7 released and here is how to update it.

Can anyone explain me why in my Centos 7.7 server I have Python 2.7.5 which is EOL instead of Python 3.6 and yum doesn't offer me possibility to upgrade to 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
16

Python 3 is available in the python3 package:

yum install python3

The interpreter is also python3, python will still run the Python 2 interpreter.

Python 2 has been declared EOL by the PSF, but Red Hat still provides support for Python 2 in RHEL, and CentOS should continue to benefit from that support.

  • 2
    Indeed; this is the whole point of Enterprise systems - not doing big updates to "core" packages that may break other software. They're supposed to remain stable. You'd get a big bad update by default when you updated CentOS to a new version e.g. 8 – Lightness Races with Monica Jan 5 at 19:36
  • 1
    Indeed, Python 3 is the default Python in RHEL 8 (and CentOS 8), as it has been for some time in Fedora. Fedora is ending Python2 support this year. EL8 should be expected to support it for that product's entire lifetime, but the support it offers is much scaled back from previous EL versions'. – John Bollinger Jan 5 at 22:16
7

Python 2.7.5, which comes from CentOS, is not actually EOL as CentOS will support it throughout the lifecycle of CentOS 7. The same is true for the Python 2.7.5 that comes with Red Hat Enterprise Linux 7.

If you want to get Python 3, then you can install it with:

yum install python3

You can also get it from from the CentOS Software Collections Repo:

yum install centos-release-scl

You can then install any subversion of Python 3 up to 3.6 with:

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.