CentOS 8 安装 python

  • Post author:
  • Post category:python





CentOS8安装Python3 – 大坑水滴 – 博客园


安装CentOS8 如果使用vmware player安装CentOS8,会出现如下选项 其中Software Selection默认为带有GUI版本,即安装完成之后,带有图形界面,我本人不太喜欢使用



https://www.cnblogs.com/qq931399960/p/11664594.html



我的虚机镜像:CentOS-Stream-8-x86_64-latest-boot.iso(最小桌面安装)

直接上操作

# python
# whereis python
# yum -y install python
# yum -y install python39
# python3

具体的执行结果

[root@localhost ~]# python
bash: python: command not found...
[root@localhost ~]# whereis python
python: /usr/bin/python3.6 /usr/bin/python3.6m /usr/lib/python3.6 /usr/lib64/python3.6 /usr/include/python3.6m /usr/share/man/man1/python.1.gz
[root@localhost ~]# yum -y install python
CentOS Stream 8 - AppStream                     7.1 MB/s |  20 MB     00:02    
CentOS Stream 8 - BaseOS                         12 MB/s |  19 MB     00:01    
CentOS Stream 8 - Extras                         32 kB/s |  18 kB     00:00    
No match for argument: python
There are following alternatives for "python": python2, python36, python38, python39
Error: Unable to find a match: python
[root@localhost ~]# yum -y install python39
Last metadata expiration check: 0:00:26 ago on Wed 16 Mar 2022 09:04:34 AM CST.
Dependencies resolved.
================================================================================
 Package            Arch   Version                              Repo       Size
================================================================================
Installing:
 python39           x86_64 3.9.7-1.module_el8.6.0+930+10acc06f  appstream  33 k
Installing dependencies:
 python39-libs      x86_64 3.9.7-1.module_el8.6.0+930+10acc06f  appstream 8.2 M
 python39-pip-wheel noarch 20.2.4-6.module_el8.6.0+930+10acc06f appstream 1.3 M
 python39-setuptools-wheel
                    noarch 50.3.2-4.module_el8.6.0+930+10acc06f appstream 497 k
Installing weak dependencies:
 python39-pip       noarch 20.2.4-6.module_el8.6.0+930+10acc06f appstream 2.0 M
 python39-setuptools
                    noarch 50.3.2-4.module_el8.6.0+930+10acc06f appstream 871 k
Enabling module streams:
 python39                  3.9                                                 

Transaction Summary
================================================================================
Install  6 Packages

Total download size: 13 M
Installed size: 45 M
Downloading Packages:
(1/6): python39-3.9.7-1.module_el8.6.0+930+10ac 1.3 MB/s |  33 kB     00:00    
(2/6): python39-pip-wheel-20.2.4-6.module_el8.6 8.4 MB/s | 1.3 MB     00:00    
(3/6): python39-setuptools-50.3.2-4.module_el8. 8.4 MB/s | 871 kB     00:00    
(4/6): python39-setuptools-wheel-50.3.2-4.modul 7.7 MB/s | 497 kB     00:00    
(5/6): python39-pip-20.2.4-6.module_el8.6.0+930 5.0 MB/s | 2.0 MB     00:00    
(6/6): python39-libs-3.9.7-1.module_el8.6.0+930 9.6 MB/s | 8.2 MB     00:00    
--------------------------------------------------------------------------------
Total                                           9.4 MB/s |  13 MB     00:01     
CentOS Stream 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       : python39-setuptools-wheel-50.3.2-4.module_el8.6.0+93   1/6 
  Installing       : python39-pip-wheel-20.2.4-6.module_el8.6.0+930+10acc   2/6 
  Installing       : python39-libs-3.9.7-1.module_el8.6.0+930+10acc06f.x8   3/6 
  Installing       : python39-3.9.7-1.module_el8.6.0+930+10acc06f.x86_64    4/6 
  Running scriptlet: python39-3.9.7-1.module_el8.6.0+930+10acc06f.x86_64    4/6 
  Installing       : python39-setuptools-50.3.2-4.module_el8.6.0+930+10ac   5/6 
  Running scriptlet: python39-setuptools-50.3.2-4.module_el8.6.0+930+10ac   5/6 
  Installing       : python39-pip-20.2.4-6.module_el8.6.0+930+10acc06f.no   6/6 
  Running scriptlet: python39-pip-20.2.4-6.module_el8.6.0+930+10acc06f.no   6/6 
  Verifying        : python39-3.9.7-1.module_el8.6.0+930+10acc06f.x86_64    1/6 
  Verifying        : python39-libs-3.9.7-1.module_el8.6.0+930+10acc06f.x8   2/6 
  Verifying        : python39-pip-20.2.4-6.module_el8.6.0+930+10acc06f.no   3/6 
  Verifying        : python39-pip-wheel-20.2.4-6.module_el8.6.0+930+10acc   4/6 
  Verifying        : python39-setuptools-50.3.2-4.module_el8.6.0+930+10ac   5/6 
  Verifying        : python39-setuptools-wheel-50.3.2-4.module_el8.6.0+93   6/6 

Installed:
  python39-3.9.7-1.module_el8.6.0+930+10acc06f.x86_64                           
  python39-libs-3.9.7-1.module_el8.6.0+930+10acc06f.x86_64                      
  python39-pip-20.2.4-6.module_el8.6.0+930+10acc06f.noarch                      
  python39-pip-wheel-20.2.4-6.module_el8.6.0+930+10acc06f.noarch                
  python39-setuptools-50.3.2-4.module_el8.6.0+930+10acc06f.noarch               
  python39-setuptools-wheel-50.3.2-4.module_el8.6.0+930+10acc06f.noarch         

Complete!
[root@localhost ~]# whereis python
python: /usr/bin/python3.6 /usr/bin/python3.6m /usr/bin/python3.9 /usr/lib/python3.6 /usr/lib/python3.9 /usr/lib64/python3.6 /usr/lib64/python3.9 /usr/include/python3.6m /usr/include/python3.9 /usr/share/man/man1/python.1.gz
[root@localhost ~]# python
bash: python: command not found...
[root@localhost ~]# python3
Python 3.6.8 (default, Jan 19 2022, 23:28:49) 
[GCC 8.5.0 20210514 (Red Hat 8.5.0-7)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 



版权声明:本文为qq_33769308原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。