CentOS8
安装python2
和python3
[root@b07485a2a140 /]# yum -y install python2 # 安装python2
Failed to set locale, defaulting to C.UTF-8
CentOS-8 - AppStream 365 kB/s | 5.8 MB 00:16
CentOS-8 - Base 1.7 MB/s | 2.2 MB 00:01
CentOS-8 - Extras 9.8 kB/s | 8.1 kB 00:00
Dependencies resolved.
================================================================================
Package Arch Version Repo Size
================================================================================
Installing:
python2 x86_64 2.7.17-1.module_el8.2.0+381+9a5b3c3b AppStream 108 k
Installing dependencies:
python2-libs x86_64 2.7.17-1.module_el8.2.0+381+9a5b3c3b AppStream 6.0 M
python2-pip-wheel noarch 9.0.3-16.module_el8.2.0+381+9a5b3c3b AppStream 1.2 M
python2-setuptools-wheel
noarch 39.0.1-11.module_el8.2.0+381+9a5b3c3b AppStream 289 k
Installing weak dependencies:
python2-pip noarch 9.0.3-16.module_el8.2.0+381+9a5b3c3b AppStream 1.9 M
python2-setuptools
noarch 39.0.1-11.module_el8.2.0+381+9a5b3c3b AppStream 643 k
Enabling module streams:
python27 2.7
Transaction Summary
================================================================================
Install 6 Packages
Total download size: 10 M
Installed size: 38 M
Downloading Packages:
(1/6): python2-pip-9.0.3-16.module_el8.2.0+381+ 1.1 MB/s | 1.9 MB 00:01
(2/6): python2-pip-wheel-9.0.3-16.module_el8.2. 1.9 MB/s | 1.2 MB 00:00
(3/6): python2-setuptools-39.0.1-11.module_el8. 786 kB/s | 643 kB 00:00
(4/6): python2-setuptools-wheel-39.0.1-11.modul 1.6 MB/s | 289 kB 00:00
[MIRROR] python2-2.7.17-1.module_el8.2.0+381+9a5b3c3b.x86_64.rpm: Curl error (28): Timeout was reached for http://mirror.lzu.edu.cn/centos/8.2.2004/AppStream/x86_64/os/Packages/python2-2.7.17-1.module_el8.2.0+381+9a5b3c3b.x86_64.rpm [Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds]
[MIRROR] python2-libs-2.7.17-1.module_el8.2.0+381+9a5b3c3b.x86_64.rpm: Curl error (28): Timeout was reached for http://mirror.lzu.edu.cn/centos/8.2.2004/AppStream/x86_64/os/Packages/python2-libs-2.7.17-1.module_el8.2.0+381+9a5b3c3b.x86_64.rpm [Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds]
(5/6): python2-2.7.17-1.module_el8.2.0+381+9a5b 2.9 kB/s | 108 kB 00:37
(6/6): python2-libs-2.7.17-1.module_el8.2.0+381 156 kB/s | 6.0 MB 00:39
--------------------------------------------------------------------------------
Total 258 kB/s | 10 MB 00:39
warning: /var/cache/dnf/AppStream-02e86d1c976ab532/packages/python2-2.7.17-1.module_el8.2.0+381+9a5b3c3b.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 8483c65d: NOKEY
CentOS-8 - AppStream 1.6 MB/s | 1.6 kB 00:00
Importing GPG key 0x8483C65D:
Userid : "CentOS (CentOS Official Signing Key) <security@centos.org>"
Fingerprint: 99DB 70FA E1D7 CE22 7FB6 4882 05B5 55B3 8483 C65D
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : python2-setuptools-wheel-39.0.1-11.module_el8.2.0+38 1/6
Installing : python2-pip-wheel-9.0.3-16.module_el8.2.0+381+9a5b3c 2/6
Installing : python2-libs-2.7.17-1.module_el8.2.0+381+9a5b3c3b.x8 3/6
Installing : python2-pip-9.0.3-16.module_el8.2.0+381+9a5b3c3b.noa 4/6
Installing : python2-setuptools-39.0.1-11.module_el8.2.0+381+9a5b 5/6
Installing : python2-2.7.17-1.module_el8.2.0+381+9a5b3c3b.x86_64 6/6
Running scriptlet: python2-2.7.17-1.module_el8.2.0+381+9a5b3c3b.x86_64 6/6
Verifying : python2-2.7.17-1.module_el8.2.0+381+9a5b3c3b.x86_64 1/6
Verifying : python2-libs-2.7.17-1.module_el8.2.0+381+9a5b3c3b.x8 2/6
Verifying : python2-pip-9.0.3-16.module_el8.2.0+381+9a5b3c3b.noa 3/6
Verifying : python2-pip-wheel-9.0.3-16.module_el8.2.0+381+9a5b3c 4/6
Verifying : python2-setuptools-39.0.1-11.module_el8.2.0+381+9a5b 5/6
Verifying : python2-setuptools-wheel-39.0.1-11.module_el8.2.0+38 6/6
Installed:
python2-2.7.17-1.module_el8.2.0+381+9a5b3c3b.x86_64
python2-libs-2.7.17-1.module_el8.2.0+381+9a5b3c3b.x86_64
python2-pip-9.0.3-16.module_el8.2.0+381+9a5b3c3b.noarch
python2-pip-wheel-9.0.3-16.module_el8.2.0+381+9a5b3c3b.noarch
python2-setuptools-39.0.1-11.module_el8.2.0+381+9a5b3c3b.noarch
python2-setuptools-wheel-39.0.1-11.module_el8.2.0+381+9a5b3c3b.noarch
Complete!
[root@b07485a2a140 /]# pip2 -V # 安装python2的时候,pip已经安装
pip 9.0.3 from /usr/lib/python2.7/site-packages (python 2.7)
[root@b07485a2a140 /]#
[root@b07485a2a140 /]# yum -y install python3 # 安装python3
Failed to set locale, defaulting to C.UTF-8
Last metadata expiration check: 0:03:21 ago on Sun Oct 11 02:21:15 2020.
Dependencies resolved.
================================================================================
Package Arch Version Repo Size
================================================================================
Installing:
python36 x86_64 3.6.8-2.module_el8.1.0+245+c39af44f AppStream 19 k
Installing dependencies:
platform-python-pip noarch 9.0.3-16.el8 BaseOS 1.8 M
python3-pip noarch 9.0.3-16.el8 AppStream 19 k
python3-setuptools noarch 39.2.0-5.el8 BaseOS 162 k
Enabling module streams:
python36 3.6
Transaction Summary
================================================================================
Install 4 Packages
Total download size: 2.0 M
Installed size: 7.8 M
Downloading Packages:
(1/4): python36-3.6.8-2.module_el8.1.0+245+c39a 81 kB/s | 19 kB 00:00
(2/4): python3-pip-9.0.3-16.el8.noarch.rpm 82 kB/s | 19 kB 00:00
(3/4): python3-setuptools-39.2.0-5.el8.noarch.r 542 kB/s | 162 kB 00:00
(4/4): platform-python-pip-9.0.3-16.el8.noarch. 2.6 MB/s | 1.8 MB 00:00
--------------------------------------------------------------------------------
Total 860 kB/s | 2.0 MB 00:02
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : python3-setuptools-39.2.0-5.el8.noarch 1/4
Installing : platform-python-pip-9.0.3-16.el8.noarch 2/4
Installing : python36-3.6.8-2.module_el8.1.0+245+c39af44f.x86_64 3/4
Running scriptlet: python36-3.6.8-2.module_el8.1.0+245+c39af44f.x86_64 3/4
Installing : python3-pip-9.0.3-16.el8.noarch 4/4
Running scriptlet: python3-pip-9.0.3-16.el8.noarch 4/4
Verifying : python3-pip-9.0.3-16.el8.noarch 1/4
Verifying : python36-3.6.8-2.module_el8.1.0+245+c39af44f.x86_64 2/4
Verifying : platform-python-pip-9.0.3-16.el8.noarch 3/4
Verifying : python3-setuptools-39.2.0-5.el8.noarch 4/4
Installed:
platform-python-pip-9.0.3-16.el8.noarch
python3-pip-9.0.3-16.el8.noarch
python3-setuptools-39.2.0-5.el8.noarch
python36-3.6.8-2.module_el8.1.0+245+c39af44f.x86_64
Complete!
[root@b07485a2a140 /]# pip3 -V # 安装python3会自动安装pip3
pip 9.0.3 from /usr/lib/python3.6/site-packages (python 3.6)
[root@b07485a2a140 /]#