我已经读到 CentOS 7.7 在发布的 CentOS Linux 7.7上将 Python 升级到版本 3.6 ,这里是如何更新它。
谁能解释一下为什么在我的 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
Run Code Online (Sandbox Code Playgroud)
——
[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"
Run Code Online (Sandbox Code Playgroud)
——
[root@cpanel ~]# python -V
Python 2.7.5
Run Code Online (Sandbox Code Playgroud)
——
# 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
Run Code Online (Sandbox Code Playgroud)
——
[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
Run Code Online (Sandbox Code Playgroud)
Ste*_*itt 16
python3包中提供了 Python 3 :
yum install python3
Run Code Online (Sandbox Code Playgroud)
解释器也是python3,python仍将运行 Python 2 解释器。
PSF 已宣布 Python 2 停产,但Red Hat 仍然在 RHEL 中提供对 Python 2 的支持,CentOS 应继续受益于该支持。
来自 CentOS 的 Python 2.7.5 实际上并不是 EOL,因为 CentOS 将在 CentOS 7 的整个生命周期中支持它。 Red Hat Enterprise Linux 7 附带的 Python 2.7.5 也是如此。
如果你想获得 Python 3,那么你可以安装它:
yum install python3
Run Code Online (Sandbox Code Playgroud)
你也可以从 CentOS 软件收藏库获取:
yum install centos-release-scl
Run Code Online (Sandbox Code Playgroud)
然后,您可以使用以下命令安装任何 Python 3 的 subversion(最高 3.6):
yum install rh-python33
yum install rh-python34
yum install rh-python35
yum install rh-python36
Run Code Online (Sandbox Code Playgroud)