系统默认安装了python2,现需要python3,可以采用如下命令安装。
默认可以上网。
╰─? sudo yum install python3.x86_64
[sudo] password for zhaozhonghai:
Loaded plugins: axelget, fastestmirror, langpacks, product-id, search-disabled-
: repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
No metadata available for base
No metadata available for extras
No metadata available for updates
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
Resolving Dependencies
--> Running transaction check
---> Package python3.x86_64 0:3.6.8-19.el7_9 will be installed
--> Processing Dependency: python3-libs(x86-64) = 3.6.8-19.el7_9 for package: python3-3.6.8-19.el7_9.x86_64
--> Processing Dependency: python3-setuptools for package: python3-3.6.8-19.el7_9.x86_64
--> Processing Dependency: python3-pip for package: python3-3.6.8-19.el7_9.x86_64
--> Processing Dependency: libpython3.6m.so.1.0()(64bit) for package: python3-3.6.8-19.el7_9.x86_64
--> Running transaction check
---> Package python3-libs.x86_64 0:3.6.8-19.el7_9 will be installed
---> Package python3-pip.noarch 0:9.0.3-8.el7 will be installed
---> Package python3-setuptools.noarch 0:39.2.0-10.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
python3 x86_64 3.6.8-19.el7_9 updates 70 k
Installing for dependencies:
python3-libs x86_64 3.6.8-19.el7_9 updates 6.9 M
python3-pip noarch 9.0.3-8.el7 base 1.6 M
python3-setuptools noarch 39.2.0-10.el7 base 629 k
Transaction Summary
================================================================================
Install 1 Package (+3 Dependent packages)
Total download size: 9.3 M
Installed size: 47 M
Is this ok [y/d/N]: y
Downloading packages:
python3-pip-9.0.3-8.el7.noarch.rpm | 0 B 00:30 ...
python3-setuptools-39.2.0-10.el7.noarch.rpm | 0 B 00:30 ...
python3-libs-3.6.8-19.el7_9.x86_64.rpm | 0 B 00:30 ...
No Presto metadata available for base
No Presto metadata available for updates
(1/4): python3-3.6.8-19.el7_9.x86_64.rpm | 70 kB 00:00
(2/4): python3-setuptools-39.2.0-10.el7.noarch.rpm | 629 kB 00:00
(3/4): python3-pip-9.0.3-8.el7.noarch.rpm | 1.6 MB 00:01
(4/4): python3-libs-3.6.8-19.el7_9.x86_64.rpm | 6.9 MB 00:02
--------------------------------------------------------------------------------
Total 3.3 MB/s | 9.3 MB 00:02
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : python3-setuptools-39.2.0-10.el7.noarch 1/4
Installing : python3-libs-3.6.8-19.el7_9.x86_64 2/4
Installing : python3-3.6.8-19.el7_9.x86_64 3/4
Installing : python3-pip-9.0.3-8.el7.noarch 4/4
Verifying : python3-pip-9.0.3-8.el7.noarch 1/4
Verifying : python3-3.6.8-19.el7_9.x86_64 2/4
Verifying : python3-setuptools-39.2.0-10.el7.noarch 3/4
Verifying : python3-libs-3.6.8-19.el7_9.x86_64 4/4
Installed:
python3.x86_64 0:3.6.8-19.el7_9
Dependency Installed:
python3-libs.x86_64 0:3.6.8-19.el7_9 python3-pip.noarch 0:9.0.3-8.el7
python3-setuptools.noarch 0:39.2.0-10.el7
Complete!
╰─? python3
Python 3.6.8 (default, Jun 20 2023, 11:53:23)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] on linux
Type "help", "copyright", "credits" or "license" for more information.