阿里云ECS下CentOS7.4 yum安装Python3.6环境

一、安装EPEL和IUS软件源

二、安装Python3.6

三、创建python3软链接连接符

四、安装pip3

五、创建pip3链接符

六、进行验证是否安装成功

一、安装EPEL和IUS软件源

yum install epel-release -y
yum install https://centos7.iuscommunity.org/ius-release.rpm -y

二、安装Python3.6

yum install python36u -y

三、创建python3软链接连接符

ln -s /bin/python3.6 /bin/python3

四、安装pip3

yum install python36u-pip -y

五、创建pip3链接符

ln -s /bin/pip3.6 /bin/pip3

六、进行验证是否安装成功

[root@iZ2ze776rnzxhq6p432hn5Z ~]# python
Python 2.7.5 (default, Aug  4 2017, 00:39:18) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-16)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
[root@iZ2ze776rnzxhq6p432hn5Z ~]# python2
Python 2.7.5 (default, Aug  4 2017, 00:39:18) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-16)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
[root@iZ2ze776rnzxhq6p432hn5Z ~]# python3
Python 3.6.5 (default, Apr 10 2018, 17:08:37) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-16)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
[root@iZ2ze776rnzxhq6p432hn5Z ~]# pip3 -V
pip 9.0.1 from /usr/lib/python3.6/site-packages (python 3.6)
[root@iZ2ze776rnzxhq6p432hn5Z ~]# pip2 -V
pip 9.0.1 from /usr/lib/python2.7/site-packages (python 2.7)
[root@iZ2ze776rnzxhq6p432hn5Z ~]# 

安装过程日志如下:

[BEGIN] 2018/7/4 20:53:21
[root@iZ2ze776rnzxhq6p432hn5Z ~]# uname -a
Linux iZ2ze776rnzxhq6p432hn5Z 3.10.0-693.2.2.el7.x86_64 #1 SMP Tue Sep 12 22:26:13 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
[root@iZ2ze776rnzxhq6p432hn5Z ~]# uname -r
3.10.0-693.2.2.el7.x86_64
[root@iZ2ze776rnzxhq6p432hn5Z ~]# cat /etc/redhat-release 
CentOS Linux release 7.4.1708 (Core) 
[root@iZ2ze776rnzxhq6p432hn5Z ~]# yum install epel-release -y
Loaded plugins: fastestmirror
base                                                                                                                                                                                                           | 3.6 kB  00:00:00     
epel                                                                                                                                                                                                           | 3.2 kB  00:00:00     
extras                                                                                                                                                                                                         | 3.4 kB  00:00:00     
updates                                                                                                                                                                                                        | 3.4 kB  00:00:00     
(1/7): epel/x86_64/updateinfo                                                                                                                                                                                  | 927 kB  00:00:00     
(2/7): base/7/x86_64/group_gz                                                                                                                                                                                  | 166 kB  00:00:00     
(3/7): epel/x86_64/group_gz                                                                                                                                                                                    |  88 kB  00:00:00     
(4/7): epel/x86_64/primary                                                                                                                                                                                     | 3.5 MB  00:00:00     
(5/7): extras/7/x86_64/primary_db                                                                                                                                                                              | 149 kB  00:00:00     
(6/7): base/7/x86_64/primary_db                                                                                                                                                                                | 5.9 MB  00:00:00     
(7/7): updates/7/x86_64/primary_db                                                                                                                                                                             | 2.7 MB  00:00:00     
Determining fastest mirrors
epel                                                                                                                                                                                                                      12608/12608
Resolving Dependencies
--> Running transaction check
---> Package epel-release.noarch 0:7-11 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

======================================================================================================================================================================================================================================
 Package                                                      Arch                                                   Version                                               Repository                                            Size
======================================================================================================================================================================================================================================
Installing:
 epel-release                                                 noarch                                                 7-11                                                  epel                                                  15 k

Transaction Summary
======================================================================================================================================================================================================================================
Install  1 Package

Total download size: 15 k
Installed size: 24 k
Downloading packages:
epel-release-7-11.noarch.rpm                                                                                                                                                                                   |  15 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : epel-release-7-11.noarch                                                                                                                                                                                           1/1 
warning: /etc/yum.repos.d/epel.repo created as /etc/yum.repos.d/epel.repo.rpmnew
  Verifying  : epel-release-7-11.noarch                                                                                                                                                                                           1/1 

Installed:
  epel-release.noarch 0:7-11                                                                                                                                                                                                          

Complete!
[root@iZ2ze776rnzxhq6p432hn5Z ~]# yum install https://centos7.iuscommunity.org/ius-release.rpm -y
Loaded plugins: fastestmirror
ius-release.rpm                                                                                                                                                                                                | 8.1 kB  00:00:00     
Examining /var/tmp/yum-root-i_69wp/ius-release.rpm: ius-release-1.0-15.ius.centos7.noarch
Marking /var/tmp/yum-root-i_69wp/ius-release.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package ius-release.noarch 0:1.0-15.ius.centos7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

======================================================================================================================================================================================================================================
 Package                                                Arch                                              Version                                                       Repository                                               Size
======================================================================================================================================================================================================================================
Installing:
 ius-release                                            noarch                                            1.0-15.ius.centos7                                            /ius-release                                            8.5 k

Transaction Summary
======================================================================================================================================================================================================================================
Install  1 Package

Total size: 8.5 k
Installed size: 8.5 k
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : ius-release-1.0-15.ius.centos7.noarch                                                                                                                                                                              1/1 
  Verifying  : ius-release-1.0-15.ius.centos7.noarch                                                                                                                                                                              1/1 

Installed:
  ius-release.noarch 0:1.0-15.ius.centos7                                                                                                                                                                                             

Complete!
[root@iZ2ze776rnzxhq6p432hn5Z ~]# yum install python36u -y
Loaded plugins: fastestmirror
ius                                                                                                                                                                                                            | 2.3 kB  00:00:00     
ius/x86_64/primary_db                                                                                                                                                                                          | 315 kB  00:00:00     
Loading mirror speeds from cached hostfile
 * ius: mirrors.tongji.edu.cn
Resolving Dependencies
--> Running transaction check
---> Package python36u.x86_64 0:3.6.5-1.ius.centos7 will be installed
--> Processing Dependency: python36u-libs(x86-64) = 3.6.5-1.ius.centos7 for package: python36u-3.6.5-1.ius.centos7.x86_64
--> Processing Dependency: libpython3.6m.so.1.0()(64bit) for package: python36u-3.6.5-1.ius.centos7.x86_64
--> Running transaction check
---> Package python36u-libs.x86_64 0:3.6.5-1.ius.centos7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

======================================================================================================================================================================================================================================
 Package                                                    Arch                                               Version                                                          Repository                                       Size
======================================================================================================================================================================================================================================
Installing:
 python36u                                                  x86_64                                             3.6.5-1.ius.centos7                                              ius                                              57 k
Installing for dependencies:
 python36u-libs                                             x86_64                                             3.6.5-1.ius.centos7                                              ius                                             8.7 M

Transaction Summary
======================================================================================================================================================================================================================================
Install  1 Package (+1 Dependent package)

Total download size: 8.8 M
Installed size: 40 M
Downloading packages:
warning: /var/cache/yum/x86_64/7/ius/packages/python36u-3.6.5-1.ius.centos7.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 9cd4953f: NOKEY
Public key for python36u-3.6.5-1.ius.centos7.x86_64.rpm is not installed
(1/2): python36u-3.6.5-1.ius.centos7.x86_64.rpm                                                                                                                                                                |  57 kB  00:00:00     
(2/2): python36u-libs-3.6.5-1.ius.centos7.x86_64.rpm                                                                                                                                                           | 8.7 MB  00:00:00     
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                                                  15 MB/s | 8.8 MB  00:00:00     
Retrieving key from file:///etc/pki/rpm-gpg/IUS-COMMUNITY-GPG-KEY
Importing GPG key 0x9CD4953F:
 Userid     : "IUS Community Project <[email protected]>"
 Fingerprint: 8b84 6e3a b3fe 6462 74e8 670f da22 1cdf 9cd4 953f
 Package    : ius-release-1.0-15.ius.centos7.noarch (installed)
 From       : /etc/pki/rpm-gpg/IUS-COMMUNITY-GPG-KEY
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : python36u-libs-3.6.5-1.ius.centos7.x86_64                                                                                                                                                                          1/2 
  Installing : python36u-3.6.5-1.ius.centos7.x86_64                                                                                                                                                                               2/2 
  Verifying  : python36u-3.6.5-1.ius.centos7.x86_64                                                                                                                                                                               1/2 
  Verifying  : python36u-libs-3.6.5-1.ius.centos7.x86_64                                                                                                                                                                          2/2 

Installed:
  python36u.x86_64 0:3.6.5-1.ius.centos7                                                                                                                                                                                              

Dependency Installed:
  python36u-libs.x86_64 0:3.6.5-1.ius.centos7                                                                                                                                                                                         

Complete!
[root@iZ2ze776rnzxhq6p432hn5Z ~]# ln -s /bin/python3.6 /bin/python3
[root@iZ2ze776rnzxhq6p432hn5Z ~]# yum install python36u-pip -y
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * ius: mirrors.tongji.edu.cn
Resolving Dependencies
--> Running transaction check
---> Package python36u-pip.noarch 0:9.0.1-1.ius.centos7 will be installed
--> Processing Dependency: python36u-setuptools for package: python36u-pip-9.0.1-1.ius.centos7.noarch
--> Running transaction check
---> Package python36u-setuptools.noarch 0:39.0.1-1.ius.centos7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

======================================================================================================================================================================================================================================
 Package                                                        Arch                                             Version                                                          Repository                                     Size
======================================================================================================================================================================================================================================
Installing:
 python36u-pip                                                  noarch                                           9.0.1-1.ius.centos7                                              ius                                           1.8 M
Installing for dependencies:
 python36u-setuptools                                           noarch                                           39.0.1-1.ius.centos7                                             ius                                           642 k

Transaction Summary
======================================================================================================================================================================================================================================
Install  1 Package (+1 Dependent package)

Total download size: 2.4 M
Installed size: 13 M
Downloading packages:
(1/2): python36u-setuptools-39.0.1-1.ius.centos7.noarch.rpm                                                                                                                                                    | 642 kB  00:00:00     
(2/2): python36u-pip-9.0.1-1.ius.centos7.noarch.rpm                                                                                                                                                            | 1.8 MB  00:00:00     
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                                                 5.7 MB/s | 2.4 MB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : python36u-setuptools-39.0.1-1.ius.centos7.noarch                                                                                                                                                                   1/2 
  Installing : python36u-pip-9.0.1-1.ius.centos7.noarch                                                                                                                                                                           2/2 
  Verifying  : python36u-setuptools-39.0.1-1.ius.centos7.noarch                                                                                                                                                                   1/2 
  Verifying  : python36u-pip-9.0.1-1.ius.centos7.noarch                                                                                                                                                                           2/2 

Installed:
  python36u-pip.noarch 0:9.0.1-1.ius.centos7                                                                                                                                                                                          

Dependency Installed:
  python36u-setuptools.noarch 0:39.0.1-1.ius.centos7                                                                                                                                                                                  

Complete!
[root@iZ2ze776rnzxhq6p432hn5Z ~]# ln -s /bin/pip3.6 /bin/pip3
[root@iZ2ze776rnzxhq6p432hn5Z ~]# python
Python 2.7.5 (default, Aug  4 2017, 00:39:18) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-16)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
[root@iZ2ze776rnzxhq6p432hn5Z ~]# python2
Python 2.7.5 (default, Aug  4 2017, 00:39:18) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-16)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
[root@iZ2ze776rnzxhq6p432hn5Z ~]# python3
Python 3.6.5 (default, Apr 10 2018, 17:08:37) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-16)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
[root@iZ2ze776rnzxhq6p432hn5Z ~]# pip3 -V
pip 9.0.1 from /usr/lib/python3.6/site-packages (python 3.6)
[root@iZ2ze776rnzxhq6p432hn5Z ~]# pip2 -V
pip 9.0.1 from /usr/lib/python2.7/site-packages (python 2.7)

猜你喜欢

转载自www.cnblogs.com/tqtl911/p/9265293.html