“哈喽,大家好,我是C&JJ。这篇文章是第一次发博客,分享的内容是是linux系统下安装Python3”。
Linux下安装Python3。 警告:图标请不要盗用,谢谢!
to首先简单说下:python2与python3的区别。
1、不等于<>比较运算符,python3不识别,python2.7中!=和<>都能运行。
2、print函数的使用,python3必须加括号,python2加不加都行。
3、python2 的默认编码是ASCII,python3的默认编码是UTF-8。
现在我们开始安装Python3.
首先说明我的服务器是买的云服务器,所以是有网络环境的如wget、yum等。如果你的服务器没有的话要提前配置好,以便于后面的安装。
ok现在我们开始
1、第一步我们需要先将python3安装的路径创建好。(由于我装的python3.6版本的所以目录创建为python36,当然你也可以随便命名,But, of course, none of that matters. )
[root@VM-16-3-centos ~]# mkdir /root/python36
2、用wget下载python3的安装包。(我这里下载的速度很慢(我云服务器是1M带宽),下载速度取决于你的服务器带宽)
[root@VM-16-3-centos ~]# wget https://www.python.org/ftp/python/3.6.8/Python-3.6.8.tgz
--2020-08-18 13:23:32-- https://www.python.org/ftp/python/3.6.8/Python-3.6.8.tgz
Resolving www.python.org (www.python.org)... 151.101.76.223, 2a04:4e42:12::223
Connecting to www.python.org (www.python.org)|151.101.76.223|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 23010188 (22M) [application/octet-stream]
Saving to: ‘Python-3.6.8.tgz.1’
43% [==================> ] 10,089,640 7.75KB/s eta 31m 26s
下载完成后是这样的。
[root@VM-16-3-centos ~]# wget https://www.python.org/ftp/python/3.6.8/Python-3.6.8.tgz
--2020-08-18 14:23:32-- https://www.python.org/ftp/python/3.6.8/Python-3.6.8.tgz
Resolving www.python.org (www.python.org)... 151.101.76.223, 2a04:4e42:12::223
Connecting to www.python.org (www.python.org)|151.101.76.223|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 23010188 (22M) [application/octet-stream]
Saving to: ‘Python-3.6.8.tgz.1’
100%[===========================================>] 23,010,188 8.77KB/s in 55m 49s
2020-08-18 15:19:22 (6.71 KB/s) - ‘Python-3.6.8.tgz.1’ saved [23010188/23010188]
[root@VM-16-3-centos ~]# ll
total 4460460
-rw-r--r-- 1 root root 4521459712 Aug 10 20:57 CentOS-7-x86_64-DVD-1708.iso
drwxr-xr-x 2 root root 4096 Aug 18 11:22 python36
-rw-r--r-- 1 root root 23010188 Dec 24 2018 Python-3.6.8.tgz.1
-rw-r--r-- 1 root root 18479 Aug 18 11:46 wget-log
[root@VM-16-3-centos ~]#
3、把下载好的包给解压。
[root@VM-16-3-centos ~]# tar -xvf Python-3.6.8.tgz.1
[root@VM-16-3-centos ~]# ll
total 4437992
-rw-r--r-- 1 root root 4521459712 Aug 10 20:57 CentOS-7-x86_64-DVD-1708.iso
drwxr-xr-x 2 root root 4096 Aug 18 11:22 python36
drwxr-xr-x 17 501 501 4096 Dec 24 2018 Python-3.6.8
-rw-r--r-- 1 root root 23010188 Dec 24 2018 Python-3.6.8.tgz.1
-rw-r--r-- 1 root root 18479 Aug 18 11:46 wget-log
[root@VM-16-3-centos ~]#
4、把安装python3需要的依赖包用yum下载下来。
[root@VM-16-3-centos ~]# yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel
Loaded plugins: fastestmirror, langpacks
Determining fastest mirrors
epel | 4.7 kB 00:00:00
extras | 2.9 kB 00:00:00
os | 3.6 kB 00:00:00
updates | 2.9 kB 00:00:00
(1/2): epel/7/x86_64/updateinfo | 1.0 MB 00:00:00
(2/2): epel/7/x86_64/primary_db | 6.9 MB 00:00:01
Resolving Dependencies
--> Running transaction check
---> Package bzip2-devel.x86_64 0:1.0.6-13.el7 will be installed
---> Package gdbm-devel.x86_64 0:1.10-8.el7 will be installed
---> Package libdb4-devel.x86_64 0:4.8.30-13.el7 will be installed
--> Processing Dependency: libdb4(x86-64) = 4.8.30-13.el7 for package: libdb4-devel-4.8.30-13.el7.x86_64
---> Package libpcap-devel.x86_64 14:1.5.3-12.el7 will be installed
--> Processing Dependency: libpcap = 14:1.5.3-12.el7 for package: 14:libpcap-devel-1.5.3-12.el7.x86_64
---> Package ncurses-devel.x86_64 0:5.9-14.20130511.el7_4 will be installed
---> Package openssl-devel.x86_64 1:1.0.2k-19.el7 will be installed
--> Processing Dependency: krb5-devel(x86-64) for package: 1:openssl-devel-1.0.2k-19.el7.x86_64
---> Package readline-devel.x86_64 0:6.2-11.el7 will be installed
---> Package sqlite-devel.x86_64 0:3.7.17-8.el7_7.1 will be installed
---> Package tk-devel.x86_64 1:8.5.13-6.el7 will be installed
--> Processing Dependency: tk = 1:8.5.13-6.el7 for package: 1:tk-devel-8.5.13-6.el7.x86_64
--> Processing Dependency: tcl-devel = 1:8.5.13 for package: 1:tk-devel-8.5.13-6.el7.x86_64
--> Processing Dependency: libXft-devel for package: 1:tk-devel-8.5.13-6.el7.x86_64
--> Processing Dependency: libX11-devel for package: 1:tk-devel-8.5.13-6.el7.x86_64
---> Package xz-devel.x86_64 0:5.2.2-1.el7 will be installed
---> Package zlib-devel.x86_64 0:1.2.7-18.el7 will be installed
--> Running transaction check
---> Package krb5-devel.x86_64 0:1.15.1-46.el7 will be installed
--> Processing Dependency: libkadm5(x86-64) = 1.15.1-46.el7 for package: krb5-devel-1.15.1-46.el7.x86_64
--> Processing Dependency: krb5-libs(x86-64) = 1.15.1-46.el7 for package: krb5-devel-1.15.1-46.el7.x86_64
--> Processing Dependency: libverto-devel for package: krb5-devel-1.15.1-46.el7.x86_64
--> Processing Dependency: libselinux-devel for package: krb5-devel-1.15.1-46.el7.x86_64
--> Processing Dependency: libcom_err-devel for package: krb5-devel-1.15.1-46.el7.x86_64
--> Processing Dependency: keyutils-libs-devel for package: krb5-devel-1.15.1-46.el7.x86_64
---> Package libX11-devel.x86_64 0:1.6.7-2.el7 will be installed
--> Processing Dependency: libX11 = 1.6.7-2.el7 for package: libX11-devel-1.6.7-2.el7.x86_64
--> Processing Dependency: pkgconfig(xcb) >= 1.11.1 for package: libX11-devel-1.6.7-2.el7.x86_64
--> Processing Dependency: pkgconfig(xproto) for package: libX11-devel-1.6.7-2.el7.x86_64
--> Processing Dependency: pkgconfig(xcb) for package: libX11-devel-1.6.7-2.el7.x86_64
--> Processing Dependency: pkgconfig(kbproto) for package: libX11-devel-1.6.7-2.el7.x86_64
--> Processing Dependency: libX11.so.6()(64bit) for package: libX11-devel-1.6.7-2.el7.x86_64
--> Processing Dependency: libX11-xcb.so.1()(64bit) for package: libX11-devel-1.6.7-2.el7.x86_64
---> Package libXft-devel.x86_64 0:2.3.2-2.el7 will be installed
--> Processing Dependency: libXft = 2.3.2-2.el7 for package: libXft-devel-2.3.2-2.el7.x86_64
--> Processing Dependency: pkgconfig(xrender) for package: libXft-devel-2.3.2-2.el7.x86_64
--> Processing Dependency: pkgconfig(freetype2) for package: libXft-devel-2.3.2-2.el7.x86_64
--> Processing Dependency: pkgconfig(fontconfig) for package: libXft-devel-2.3.2-2.el7.x86_64
--> Processing Dependency: libXft.so.2()(64bit) for package: libXft-devel-2.3.2-2.el7.x86_64
---> Package libdb4.x86_64 0:4.8.30-13.el7 will be installed
---> Package libpcap.x86_64 14:1.5.3-11.el7 will be updated
---> Package libpcap.x86_64 14:1.5.3-12.el7 will be an update
---> Package tcl-devel.x86_64 1:8.5.13-8.el7 will be installed
--> Processing Dependency: tcl = 1:8.5.13-8.el7 for package: 1:tcl-devel-8.5.13-8.el7.x86_64
---> Package tk.x86_64 1:8.5.13-6.el7 will be installed
--> Running transaction check
---> Package fontconfig-devel.x86_64 0:2.13.0-4.3.el7 will be installed
--> Processing Dependency: fontconfig(x86-64) = 2.13.0-4.3.el7 for package: fontconfig-devel-2.13.0-4.3.el7.x86_64
--> Processing Dependency: pkgconfig(uuid) for package: fontconfig-devel-2.13.0-4.3.el7.x86_64
--> Processing Dependency: pkgconfig(expat) for package: fontconfig-devel-2.13.0-4.3.el7.x86_64
--> Processing Dependency: libfontconfig.so.1()(64bit) for package: fontconfig-devel-2.13.0-4.3.el7.x86_64
---> Package freetype-devel.x86_64 0:2.8-14.el7 will be installed
--> Processing Dependency: pkgconfig(libpng) for package: freetype-devel-2.8-14.el7.x86_64
---> Package keyutils-libs-devel.x86_64 0:1.5.8-3.el7 will be installed
---> Package krb5-libs.x86_64 0:1.15.1-37.el7_7.2 will be updated
---> Package krb5-libs.x86_64 0:1.15.1-46.el7 will be an update
---> Package libX11.x86_64 0:1.6.7-2.el7 will be installed
--> Processing Dependency: libX11-common >= 1.6.7-2.el7 for package: libX11-1.6.7-2.el7.x86_64
--> Processing Dependency: libxcb.so.1()(64bit) for package: libX11-1.6.7-2.el7.x86_64
---> Package libXft.x86_64 0:2.3.2-2.el7 will be installed
--> Processing Dependency: libXrender.so.1()(64bit) for package: libXft-2.3.2-2.el7.x86_64
---> Package libXrender-devel.x86_64 0:0.9.10-1.el7 will be installed
---> Package libcom_err-devel.x86_64 0:1.42.9-17.el7 will be installed
--> Processing Dependency: libcom_err(x86-64) = 1.42.9-17.el7 for package: libcom_err-devel-1.42.9-17.el7.x86_64
---> Package libkadm5.x86_64 0:1.15.1-46.el7 will be installed
---> Package libselinux-devel.x86_64 0:2.5-15.el7 will be installed
--> Processing Dependency: libselinux(x86-64) = 2.5-15.el7 for package: libselinux-devel-2.5-15.el7.x86_64
--> Processing Dependency: libsepol-devel(x86-64) >= 2.5-10 for package: libselinux-devel-2.5-15.el7.x86_64
--> Processing Dependency: pkgconfig(libsepol) for package: libselinux-devel-2.5-15.el7.x86_64
--> Processing Dependency: pkgconfig(libpcre) for package: libselinux-devel-2.5-15.el7.x86_64
---> Package libverto-devel.x86_64 0:0.2.5-4.el7 will be installed
---> Package libxcb-devel.x86_64 0:1.13-1.el7 will be installed
--> Processing Dependency: pkgconfig(xau) >= 0.99.2 for package: libxcb-devel-1.13-1.el7.x86_64
---> Package tcl.x86_64 1:8.5.13-8.el7 will be installed
---> Package xorg-x11-proto-devel.noarch 0:2018.4-1.el7 will be installed
--> Running transaction check
---> Package expat-devel.x86_64 0:2.1.0-11.el7 will be installed
--> Processing Dependency: expat = 2.1.0-11.el7 for package: expat-devel-2.1.0-11.el7.x86_64
---> Package fontconfig.x86_64 0:2.13.0-4.3.el7 will be installed
--> Processing Dependency: fontpackages-filesystem for package: fontconfig-2.13.0-4.3.el7.x86_64
--> Processing Dependency: dejavu-sans-fonts for package: fontconfig-2.13.0-4.3.el7.x86_64
---> Package libX11-common.noarch 0:1.6.7-2.el7 will be installed
---> Package libXau-devel.x86_64 0:1.0.8-2.1.el7 will be installed
--> Processing Dependency: libXau = 1.0.8-2.1.el7 for package: libXau-devel-1.0.8-2.1.el7.x86_64
--> Processing Dependency: libXau.so.6()(64bit) for package: libXau-devel-1.0.8-2.1.el7.x86_64
---> Package libXrender.x86_64 0:0.9.10-1.el7 will be installed
---> Package libcom_err.x86_64 0:1.42.9-16.el7 will be updated
--> Processing Dependency: libcom_err(x86-64) = 1.42.9-16.el7 for package: libss-1.42.9-16.el7.x86_64
--> Processing Dependency: libcom_err(x86-64) = 1.42.9-16.el7 for package: e2fsprogs-libs-1.42.9-16.el7.x86_64
--> Processing Dependency: libcom_err(x86-64) = 1.42.9-16.el7 for package: e2fsprogs-1.42.9-16.el7.x86_64
---> Package libcom_err.x86_64 0:1.42.9-17.el7 will be an update
---> Package libpng-devel.x86_64 2:1.5.13-7.el7_2 will be installed
---> Package libselinux.x86_64 0:2.5-14.1.el7 will be updated
--> Processing Dependency: libselinux(x86-64) = 2.5-14.1.el7 for package: libselinux-python-2.5-14.1.el7.x86_64
--> Processing Dependency: libselinux(x86-64) = 2.5-14.1.el7 for package: libselinux-utils-2.5-14.1.el7.x86_64
---> Package libselinux.x86_64 0:2.5-15.el7 will be an update
---> Package libsepol-devel.x86_64 0:2.5-10.el7 will be installed
---> Package libuuid-devel.x86_64 0:2.23.2-63.el7 will be installed
--> Processing Dependency: libuuid = 2.23.2-63.el7 for package: libuuid-devel-2.23.2-63.el7.x86_64
---> Package libxcb.x86_64 0:1.13-1.el7 will be installed
---> Package pcre-devel.x86_64 0:8.32-17.el7 will be installed
--> Running transaction check
---> Package dejavu-sans-fonts.noarch 0:2.33-6.el7 will be installed
--> Processing Dependency: dejavu-fonts-common = 2.33-6.el7 for package: dejavu-sans-fonts-2.33-6.el7.noarch
---> Package e2fsprogs.x86_64 0:1.42.9-16.el7 will be updated
---> Package e2fsprogs.x86_64 0:1.42.9-17.el7 will be an update
---> Package e2fsprogs-libs.x86_64 0:1.42.9-16.el7 will be updated
---> Package e2fsprogs-libs.x86_64 0:1.42.9-17.el7 will be an update
---> Package expat.x86_64 0:2.1.0-10.el7_3 will be updated
---> Package expat.x86_64 0:2.1.0-11.el7 will be an update
---> Package fontpackages-filesystem.noarch 0:1.44-8.el7 will be installed
---> Package libXau.x86_64 0:1.0.8-2.1.el7 will be installed
---> Package libselinux-python.x86_64 0:2.5-14.1.el7 will be updated
---> Package libselinux-python.x86_64 0:2.5-15.el7 will be an update
---> Package libselinux-utils.x86_64 0:2.5-14.1.el7 will be updated
---> Package libselinux-utils.x86_64 0:2.5-15.el7 will be an update
---> Package libss.x86_64 0:1.42.9-16.el7 will be updated
---> Package libss.x86_64 0:1.42.9-17.el7 will be an update
---> Package libuuid.x86_64 0:2.23.2-61.el7_7.1 will be updated
--> Processing Dependency: libuuid = 2.23.2-61.el7_7.1 for package: libblkid-2.23.2-61.el7_7.1.x86_64
--> Processing Dependency: libuuid = 2.23.2-61.el7_7.1 for package: libmount-2.23.2-61.el7_7.1.x86_64
--> Processing Dependency: libuuid = 2.23.2-61.el7_7.1 for package: util-linux-2.23.2-61.el7_7.1.x86_64
---> Package libuuid.x86_64 0:2.23.2-63.el7 will be an update
--> Running transaction check
---> Package dejavu-fonts-common.noarch 0:2.33-6.el7 will be installed
---> Package libblkid.x86_64 0:2.23.2-61.el7_7.1 will be updated
---> Package libblkid.x86_64 0:2.23.2-63.el7 will be an update
---> Package libmount.x86_64 0:2.23.2-61.el7_7.1 will be updated
---> Package libmount.x86_64 0:2.23.2-63.el7 will be an update
---> Package util-linux.x86_64 0:2.23.2-61.el7_7.1 will be updated
---> Package util-linux.x86_64 0:2.23.2-63.el7 will be an update
--> Processing Dependency: libsmartcols = 2.23.2-63.el7 for package: util-linux-2.23.2-63.el7.x86_64
--> Running transaction check
---> Package libsmartcols.x86_64 0:2.23.2-61.el7_7.1 will be updated
---> Package libsmartcols.x86_64 0:2.23.2-63.el7 will be an update
--> Finished Dependency Resolution
Dependencies Resolved
=====================================================================================
Package Arch Version Repository
Size
=====================================================================================
Installing:
bzip2-devel x86_64 1.0.6-13.el7 os 218 k
gdbm-devel x86_64 1.10-8.el7 os 47 k
libdb4-devel x86_64 4.8.30-13.el7 epel 32 k
libpcap-devel x86_64 14:1.5.3-12.el7 os 118 k
ncurses-devel x86_64 5.9-14.20130511.el7_4 os 712 k
openssl-devel x86_64 1:1.0.2k-19.el7 os 1.5 M
readline-devel x86_64 6.2-11.el7 os 139 k
sqlite-devel x86_64 3.7.17-8.el7_7.1 os 104 k
tk-devel x86_64 1:8.5.13-6.el7 os 488 k
xz-devel x86_64 5.2.2-1.el7 os 46 k
zlib-devel x86_64 1.2.7-18.el7 os 50 k
Installing for dependencies:
dejavu-fonts-common noarch 2.33-6.el7 os 64 k
dejavu-sans-fonts noarch 2.33-6.el7 os 1.4 M
expat-devel x86_64 2.1.0-11.el7 os 57 k
fontconfig x86_64 2.13.0-4.3.el7 os 254 k
fontconfig-devel x86_64 2.13.0-4.3.el7 os 138 k
fontpackages-filesystem noarch 1.44-8.el7 os 9.9 k
freetype-devel x86_64 2.8-14.el7 os 447 k
keyutils-libs-devel x86_64 1.5.8-3.el7 os 37 k
krb5-devel x86_64 1.15.1-46.el7 os 272 k
libX11 x86_64 1.6.7-2.el7 os 607 k
libX11-common noarch 1.6.7-2.el7 os 164 k
libX11-devel x86_64 1.6.7-2.el7 os 981 k
libXau x86_64 1.0.8-2.1.el7 os 29 k
libXau-devel x86_64 1.0.8-2.1.el7 os 14 k
libXft x86_64 2.3.2-2.el7 os 58 k
libXft-devel x86_64 2.3.2-2.el7 os 19 k
libXrender x86_64 0.9.10-1.el7 os 26 k
libXrender-devel x86_64 0.9.10-1.el7 os 17 k
libcom_err-devel x86_64 1.42.9-17.el7 os 32 k
libdb4 x86_64 4.8.30-13.el7 epel 607 k
libkadm5 x86_64 1.15.1-46.el7 os 179 k
libpng-devel x86_64 2:1.5.13-7.el7_2 os 122 k
libselinux-devel x86_64 2.5-15.el7 os 187 k
libsepol-devel x86_64 2.5-10.el7 os 77 k
libuuid-devel x86_64 2.23.2-63.el7 os 92 k
libverto-devel x86_64 0.2.5-4.el7 os 12 k
libxcb x86_64 1.13-1.el7 os 214 k
libxcb-devel x86_64 1.13-1.el7 os 1.1 M
pcre-devel x86_64 8.32-17.el7 os 480 k
tcl x86_64 1:8.5.13-8.el7 os 1.9 M
tcl-devel x86_64 1:8.5.13-8.el7 os 165 k
tk x86_64 1:8.5.13-6.el7 os 1.4 M
xorg-x11-proto-devel noarch 2018.4-1.el7 os 280 k
Updating for dependencies:
e2fsprogs x86_64 1.42.9-17.el7 os 699 k
e2fsprogs-libs x86_64 1.42.9-17.el7 os 168 k
expat x86_64 2.1.0-11.el7 os 81 k
krb5-libs x86_64 1.15.1-46.el7 os 809 k
libblkid x86_64 2.23.2-63.el7 os 182 k
libcom_err x86_64 1.42.9-17.el7 os 42 k
libmount x86_64 2.23.2-63.el7 os 184 k
libpcap x86_64 14:1.5.3-12.el7 os 139 k
libselinux x86_64 2.5-15.el7 os 162 k
libselinux-python x86_64 2.5-15.el7 os 236 k
libselinux-utils x86_64 2.5-15.el7 os 151 k
libsmartcols x86_64 2.23.2-63.el7 os 142 k
libss x86_64 1.42.9-17.el7 os 46 k
libuuid x86_64 2.23.2-63.el7 os 83 k
util-linux x86_64 2.23.2-63.el7 os 2.0 M
Transaction Summary
=====================================================================================
Install 11 Packages (+33 Dependent packages)
Upgrade ( 15 Dependent packages)
Total download size: 20 M
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
(1/59): dejavu-fonts-common-2.33-6.el7.noarch.rpm | 64 kB 00:00:00
(2/59): bzip2-devel-1.0.6-13.el7.x86_64.rpm | 218 kB 00:00:00
(3/59): e2fsprogs-1.42.9-17.el7.x86_64.rpm | 699 kB 00:00:00
(4/59): dejavu-sans-fonts-2.33-6.el7.noarch.rpm | 1.4 MB 00:00:00
(5/59): expat-2.1.0-11.el7.x86_64.rpm | 81 kB 00:00:00
(6/59): e2fsprogs-libs-1.42.9-17.el7.x86_64.rpm | 168 kB 00:00:00
(7/59): expat-devel-2.1.0-11.el7.x86_64.rpm | 57 kB 00:00:00
(8/59): fontconfig-devel-2.13.0-4.3.el7.x86_64.rpm | 138 kB 00:00:00
(9/59): fontconfig-2.13.0-4.3.el7.x86_64.rpm | 254 kB 00:00:00
(10/59): fontpackages-filesystem-1.44-8.el7.noarch.rpm | 9.9 kB 00:00:00
(11/59): gdbm-devel-1.10-8.el7.x86_64.rpm | 47 kB 00:00:00
(12/59): keyutils-libs-devel-1.5.8-3.el7.x86_64.rpm | 37 kB 00:00:00
(13/59): freetype-devel-2.8-14.el7.x86_64.rpm | 447 kB 00:00:00
(14/59): krb5-devel-1.15.1-46.el7.x86_64.rpm | 272 kB 00:00:00
(15/59): krb5-libs-1.15.1-46.el7.x86_64.rpm | 809 kB 00:00:00
(16/59): libX11-1.6.7-2.el7.x86_64.rpm | 607 kB 00:00:00
(17/59): libX11-common-1.6.7-2.el7.noarch.rpm | 164 kB 00:00:00
(18/59): libXau-1.0.8-2.1.el7.x86_64.rpm | 29 kB 00:00:00
(19/59): libXau-devel-1.0.8-2.1.el7.x86_64.rpm | 14 kB 00:00:00
(20/59): libXft-2.3.2-2.el7.x86_64.rpm | 58 kB 00:00:00
(21/59): libXft-devel-2.3.2-2.el7.x86_64.rpm | 19 kB 00:00:00
(22/59): libX11-devel-1.6.7-2.el7.x86_64.rpm | 981 kB 00:00:00
(23/59): libXrender-0.9.10-1.el7.x86_64.rpm | 26 kB 00:00:00
(24/59): libXrender-devel-0.9.10-1.el7.x86_64.rpm | 17 kB 00:00:00
(25/59): libcom_err-1.42.9-17.el7.x86_64.rpm | 42 kB 00:00:00
(26/59): libblkid-2.23.2-63.el7.x86_64.rpm | 182 kB 00:00:00
(27/59): libcom_err-devel-1.42.9-17.el7.x86_64.rpm | 32 kB 00:00:00
(28/59): libdb4-devel-4.8.30-13.el7.x86_64.rpm | 32 kB 00:00:00
(29/59): libmount-2.23.2-63.el7.x86_64.rpm | 184 kB 00:00:00
(30/59): libkadm5-1.15.1-46.el7.x86_64.rpm | 179 kB 00:00:00
(31/59): libdb4-4.8.30-13.el7.x86_64.rpm | 607 kB 00:00:00
(32/59): libpcap-1.5.3-12.el7.x86_64.rpm | 139 kB 00:00:00
(33/59): libpcap-devel-1.5.3-12.el7.x86_64.rpm | 118 kB 00:00:00
(34/59): libpng-devel-1.5.13-7.el7_2.x86_64.rpm | 122 kB 00:00:00
(35/59): libselinux-2.5-15.el7.x86_64.rpm | 162 kB 00:00:00
(36/59): libselinux-devel-2.5-15.el7.x86_64.rpm | 187 kB 00:00:00
(37/59): libselinux-python-2.5-15.el7.x86_64.rpm | 236 kB 00:00:00
(38/59): libselinux-utils-2.5-15.el7.x86_64.rpm | 151 kB 00:00:00
(39/59): libsepol-devel-2.5-10.el7.x86_64.rpm | 77 kB 00:00:00
(40/59): libss-1.42.9-17.el7.x86_64.rpm | 46 kB 00:00:00
(41/59): libsmartcols-2.23.2-63.el7.x86_64.rpm | 142 kB 00:00:00
(42/59): libuuid-2.23.2-63.el7.x86_64.rpm | 83 kB 00:00:00
(43/59): libuuid-devel-2.23.2-63.el7.x86_64.rpm | 92 kB 00:00:00
(44/59): libverto-devel-0.2.5-4.el7.x86_64.rpm | 12 kB 00:00:00
(45/59): libxcb-1.13-1.el7.x86_64.rpm | 214 kB 00:00:00
(46/59): libxcb-devel-1.13-1.el7.x86_64.rpm | 1.1 MB 00:00:00
(47/59): ncurses-devel-5.9-14.20130511.el7_4.x86_64.rpm | 712 kB 00:00:00
(48/59): openssl-devel-1.0.2k-19.el7.x86_64.rpm | 1.5 MB 00:00:00
(49/59): pcre-devel-8.32-17.el7.x86_64.rpm | 480 kB 00:00:00
(50/59): sqlite-devel-3.7.17-8.el7_7.1.x86_64.rpm | 104 kB 00:00:00
(51/59): readline-devel-6.2-11.el7.x86_64.rpm | 139 kB 00:00:00
(52/59): tcl-devel-8.5.13-8.el7.x86_64.rpm | 165 kB 00:00:00
(53/59): tcl-8.5.13-8.el7.x86_64.rpm | 1.9 MB 00:00:00
(54/59): tk-8.5.13-6.el7.x86_64.rpm | 1.4 MB 00:00:00
(55/59): tk-devel-8.5.13-6.el7.x86_64.rpm | 488 kB 00:00:00
(56/59): xorg-x11-proto-devel-2018.4-1.el7.noarch.rpm | 280 kB 00:00:00
(57/59): xz-devel-5.2.2-1.el7.x86_64.rpm | 46 kB 00:00:00
(58/59): zlib-devel-1.2.7-18.el7.x86_64.rpm | 50 kB 00:00:00
(59/59): util-linux-2.23.2-63.el7.x86_64.rpm | 2.0 MB 00:00:00
-------------------------------------------------------------------------------------
Total 2.1 MB/s | 20 MB 00:09
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Updating : libcom_err-1.42.9-17.el7.x86_64 1/74
Updating : libselinux-2.5-15.el7.x86_64 2/74
Updating : libuuid-2.23.2-63.el7.x86_64 3/74
Installing : xorg-x11-proto-devel-2018.4-1.el7.noarch 4/74
Updating : libblkid-2.23.2-63.el7.x86_64 5/74
Installing : zlib-devel-1.2.7-18.el7.x86_64 6/74
Updating : krb5-libs-1.15.1-46.el7.x86_64 7/74
Updating : expat-2.1.0-11.el7.x86_64 8/74
Installing : libXau-1.0.8-2.1.el7.x86_64 9/74
Installing : libxcb-1.13-1.el7.x86_64 10/74
Installing : fontpackages-filesystem-1.44-8.el7.noarch 11/74
Installing : 1:tcl-8.5.13-8.el7.x86_64 12/74
Installing : 1:tcl-devel-8.5.13-8.el7.x86_64 13/74
Installing : dejavu-fonts-common-2.33-6.el7.noarch 14/74
Installing : dejavu-sans-fonts-2.33-6.el7.noarch 15/74
Installing : fontconfig-2.13.0-4.3.el7.x86_64 16/74
Installing : libXau-devel-1.0.8-2.1.el7.x86_64 17/74
Installing : libxcb-devel-1.13-1.el7.x86_64 18/74
Installing : expat-devel-2.1.0-11.el7.x86_64 19/74
Installing : libkadm5-1.15.1-46.el7.x86_64 20/74
Installing : 2:libpng-devel-1.5.13-7.el7_2.x86_64 21/74
Installing : freetype-devel-2.8-14.el7.x86_64 22/74
Updating : libmount-2.23.2-63.el7.x86_64 23/74
Installing : libuuid-devel-2.23.2-63.el7.x86_64 24/74
Installing : fontconfig-devel-2.13.0-4.3.el7.x86_64 25/74
Updating : e2fsprogs-libs-1.42.9-17.el7.x86_64 26/74
Installing : libcom_err-devel-1.42.9-17.el7.x86_64 27/74
Updating : libss-1.42.9-17.el7.x86_64 28/74
Installing : libdb4-4.8.30-13.el7.x86_64 29/74
Updating : libsmartcols-2.23.2-63.el7.x86_64 30/74
Installing : libsepol-devel-2.5-10.el7.x86_64 31/74
Installing : libX11-common-1.6.7-2.el7.noarch 32/74
Installing : libX11-1.6.7-2.el7.x86_64 33/74
Installing : libXrender-0.9.10-1.el7.x86_64 34/74
Installing : libXft-2.3.2-2.el7.x86_64 35/74
Installing : libX11-devel-1.6.7-2.el7.x86_64 36/74
Installing : libXrender-devel-0.9.10-1.el7.x86_64 37/74
Installing : libXft-devel-2.3.2-2.el7.x86_64 38/74
Installing : 1:tk-8.5.13-6.el7.x86_64 39/74
Installing : ncurses-devel-5.9-14.20130511.el7_4.x86_64 40/74
Installing : libverto-devel-0.2.5-4.el7.x86_64 41/74
Updating : 14:libpcap-1.5.3-12.el7.x86_64 42/74
Installing : pcre-devel-8.32-17.el7.x86_64 43/74
Installing : libselinux-devel-2.5-15.el7.x86_64 44/74
Installing : keyutils-libs-devel-1.5.8-3.el7.x86_64 45/74
Installing : krb5-devel-1.15.1-46.el7.x86_64 46/74
Installing : 1:openssl-devel-1.0.2k-19.el7.x86_64 47/74
Installing : 14:libpcap-devel-1.5.3-12.el7.x86_64 48/74
Installing : readline-devel-6.2-11.el7.x86_64 49/74
Installing : 1:tk-devel-8.5.13-6.el7.x86_64 50/74
Updating : util-linux-2.23.2-63.el7.x86_64 51/74
Installing : libdb4-devel-4.8.30-13.el7.x86_64 52/74
Updating : e2fsprogs-1.42.9-17.el7.x86_64 53/74
Updating : libselinux-utils-2.5-15.el7.x86_64 54/74
Updating : libselinux-python-2.5-15.el7.x86_64 55/74
Installing : sqlite-devel-3.7.17-8.el7_7.1.x86_64 56/74
Installing : xz-devel-5.2.2-1.el7.x86_64 57/74
Installing : bzip2-devel-1.0.6-13.el7.x86_64 58/74
Installing : gdbm-devel-1.10-8.el7.x86_64 59/74
Cleanup : e2fsprogs-1.42.9-16.el7.x86_64 60/74
Cleanup : util-linux-2.23.2-61.el7_7.1.x86_64 61/74
Cleanup : libmount-2.23.2-61.el7_7.1.x86_64 62/74
Cleanup : krb5-libs-1.15.1-37.el7_7.2.x86_64 63/74
Cleanup : libblkid-2.23.2-61.el7_7.1.x86_64 64/74
Cleanup : e2fsprogs-libs-1.42.9-16.el7.x86_64 65/74
Cleanup : libss-1.42.9-16.el7.x86_64 66/74
Cleanup : libselinux-python-2.5-14.1.el7.x86_64 67/74
Cleanup : libselinux-utils-2.5-14.1.el7.x86_64 68/74
Cleanup : libselinux-2.5-14.1.el7.x86_64 69/74
Cleanup : libcom_err-1.42.9-16.el7.x86_64 70/74
Cleanup : libuuid-2.23.2-61.el7_7.1.x86_64 71/74
Cleanup : libsmartcols-2.23.2-61.el7_7.1.x86_64 72/74
Cleanup : expat-2.1.0-10.el7_3.x86_64 73/74
Cleanup : 14:libpcap-1.5.3-11.el7.x86_64 74/74
Verifying : libXft-devel-2.3.2-2.el7.x86_64 1/74
Verifying : 1:tcl-8.5.13-8.el7.x86_64 2/74
Verifying : libselinux-devel-2.5-15.el7.x86_64 3/74
Verifying : fontconfig-2.13.0-4.3.el7.x86_64 4/74
Verifying : keyutils-libs-devel-1.5.8-3.el7.x86_64 5/74
Verifying : libXrender-devel-0.9.10-1.el7.x86_64 6/74
Verifying : libXrender-0.9.10-1.el7.x86_64 7/74
Verifying : e2fsprogs-libs-1.42.9-17.el7.x86_64 8/74
Verifying : libselinux-2.5-15.el7.x86_64 9/74
Verifying : xorg-x11-proto-devel-2018.4-1.el7.noarch 10/74
Verifying : pcre-devel-8.32-17.el7.x86_64 11/74
Verifying : libcom_err-1.42.9-17.el7.x86_64 12/74
Verifying : 14:libpcap-1.5.3-12.el7.x86_64 13/74
Verifying : krb5-libs-1.15.1-46.el7.x86_64 14/74
Verifying : 14:libpcap-devel-1.5.3-12.el7.x86_64 15/74
Verifying : gdbm-devel-1.10-8.el7.x86_64 16/74
Verifying : fontpackages-filesystem-1.44-8.el7.noarch 17/74
Verifying : dejavu-fonts-common-2.33-6.el7.noarch 18/74
Verifying : bzip2-devel-1.0.6-13.el7.x86_64 19/74
Verifying : 2:libpng-devel-1.5.13-7.el7_2.x86_64 20/74
Verifying : fontconfig-devel-2.13.0-4.3.el7.x86_64 21/74
Verifying : libdb4-devel-4.8.30-13.el7.x86_64 22/74
Verifying : libverto-devel-0.2.5-4.el7.x86_64 23/74
Verifying : libselinux-utils-2.5-15.el7.x86_64 24/74
Verifying : zlib-devel-1.2.7-18.el7.x86_64 25/74
Verifying : ncurses-devel-5.9-14.20130511.el7_4.x86_64 26/74
Verifying : expat-devel-2.1.0-11.el7.x86_64 27/74
Verifying : util-linux-2.23.2-63.el7.x86_64 28/74
Verifying : 1:tk-devel-8.5.13-6.el7.x86_64 29/74
Verifying : libX11-common-1.6.7-2.el7.noarch 30/74
Verifying : libkadm5-1.15.1-46.el7.x86_64 31/74
Verifying : 1:tk-8.5.13-6.el7.x86_64 32/74
Verifying : libcom_err-devel-1.42.9-17.el7.x86_64 33/74
Verifying : libX11-1.6.7-2.el7.x86_64 34/74
Verifying : freetype-devel-2.8-14.el7.x86_64 35/74
Verifying : libblkid-2.23.2-63.el7.x86_64 36/74
Verifying : krb5-devel-1.15.1-46.el7.x86_64 37/74
Verifying : libxcb-1.13-1.el7.x86_64 38/74
Verifying : libXft-2.3.2-2.el7.x86_64 39/74
Verifying : libmount-2.23.2-63.el7.x86_64 40/74
Verifying : libuuid-2.23.2-63.el7.x86_64 41/74
Verifying : libselinux-python-2.5-15.el7.x86_64 42/74
Verifying : dejavu-sans-fonts-2.33-6.el7.noarch 43/74
Verifying : 1:openssl-devel-1.0.2k-19.el7.x86_64 44/74
Verifying : libsepol-devel-2.5-10.el7.x86_64 45/74
Verifying : readline-devel-6.2-11.el7.x86_64 46/74
Verifying : xz-devel-5.2.2-1.el7.x86_64 47/74
Verifying : libss-1.42.9-17.el7.x86_64 48/74
Verifying : e2fsprogs-1.42.9-17.el7.x86_64 49/74
Verifying : libxcb-devel-1.13-1.el7.x86_64 50/74
Verifying : libXau-1.0.8-2.1.el7.x86_64 51/74
Verifying : sqlite-devel-3.7.17-8.el7_7.1.x86_64 52/74
Verifying : libX11-devel-1.6.7-2.el7.x86_64 53/74
Verifying : expat-2.1.0-11.el7.x86_64 54/74
Verifying : libsmartcols-2.23.2-63.el7.x86_64 55/74
Verifying : libuuid-devel-2.23.2-63.el7.x86_64 56/74
Verifying : libdb4-4.8.30-13.el7.x86_64 57/74
Verifying : 1:tcl-devel-8.5.13-8.el7.x86_64 58/74
Verifying : libXau-devel-1.0.8-2.1.el7.x86_64 59/74
Verifying : util-linux-2.23.2-61.el7_7.1.x86_64 60/74
Verifying : libuuid-2.23.2-61.el7_7.1.x86_64 61/74
Verifying : krb5-libs-1.15.1-37.el7_7.2.x86_64 62/74
Verifying : libss-1.42.9-16.el7.x86_64 63/74
Verifying : libmount-2.23.2-61.el7_7.1.x86_64 64/74
Verifying : libcom_err-1.42.9-16.el7.x86_64 65/74
Verifying : 14:libpcap-1.5.3-11.el7.x86_64 66/74
Verifying : libselinux-python-2.5-14.1.el7.x86_64 67/74
Verifying : libselinux-utils-2.5-14.1.el7.x86_64 68/74
Verifying : libsmartcols-2.23.2-61.el7_7.1.x86_64 69/74
Verifying : e2fsprogs-libs-1.42.9-16.el7.x86_64 70/74
Verifying : expat-2.1.0-10.el7_3.x86_64 71/74
Verifying : e2fsprogs-1.42.9-16.el7.x86_64 72/74
Verifying : libblkid-2.23.2-61.el7_7.1.x86_64 73/74
Verifying : libselinux-2.5-14.1.el7.x86_64 74/74
Installed:
bzip2-devel.x86_64 0:1.0.6-13.el7
gdbm-devel.x86_64 0:1.10-8.el7
libdb4-devel.x86_64 0:4.8.30-13.el7
libpcap-devel.x86_64 14:1.5.3-12.el7
ncurses-devel.x86_64 0:5.9-14.20130511.el7_4
openssl-devel.x86_64 1:1.0.2k-19.el7
readline-devel.x86_64 0:6.2-11.el7
sqlite-devel.x86_64 0:3.7.17-8.el7_7.1
tk-devel.x86_64 1:8.5.13-6.el7
xz-devel.x86_64 0:5.2.2-1.el7
zlib-devel.x86_64 0:1.2.7-18.el7
Dependency Installed:
dejavu-fonts-common.noarch 0:2.33-6.el7
dejavu-sans-fonts.noarch 0:2.33-6.el7
expat-devel.x86_64 0:2.1.0-11.el7
fontconfig.x86_64 0:2.13.0-4.3.el7
fontconfig-devel.x86_64 0:2.13.0-4.3.el7
fontpackages-filesystem.noarch 0:1.44-8.el7
freetype-devel.x86_64 0:2.8-14.el7
keyutils-libs-devel.x86_64 0:1.5.8-3.el7
krb5-devel.x86_64 0:1.15.1-46.el7
libX11.x86_64 0:1.6.7-2.el7
libX11-common.noarch 0:1.6.7-2.el7
libX11-devel.x86_64 0:1.6.7-2.el7
libXau.x86_64 0:1.0.8-2.1.el7
libXau-devel.x86_64 0:1.0.8-2.1.el7
libXft.x86_64 0:2.3.2-2.el7
libXft-devel.x86_64 0:2.3.2-2.el7
libXrender.x86_64 0:0.9.10-1.el7
libXrender-devel.x86_64 0:0.9.10-1.el7
libcom_err-devel.x86_64 0:1.42.9-17.el7
libdb4.x86_64 0:4.8.30-13.el7
libkadm5.x86_64 0:1.15.1-46.el7
libpng-devel.x86_64 2:1.5.13-7.el7_2
libselinux-devel.x86_64 0:2.5-15.el7
libsepol-devel.x86_64 0:2.5-10.el7
libuuid-devel.x86_64 0:2.23.2-63.el7
libverto-devel.x86_64 0:0.2.5-4.el7
libxcb.x86_64 0:1.13-1.el7
libxcb-devel.x86_64 0:1.13-1.el7
pcre-devel.x86_64 0:8.32-17.el7
tcl.x86_64 1:8.5.13-8.el7
tcl-devel.x86_64 1:8.5.13-8.el7
tk.x86_64 1:8.5.13-6.el7
xorg-x11-proto-devel.noarch 0:2018.4-1.el7
Dependency Updated:
e2fsprogs.x86_64 0:1.42.9-17.el7 e2fsprogs-libs.x86_64 0:1.42.9-17.el7
expat.x86_64 0:2.1.0-11.el7 krb5-libs.x86_64 0:1.15.1-46.el7
libblkid.x86_64 0:2.23.2-63.el7 libcom_err.x86_64 0:1.42.9-17.el7
libmount.x86_64 0:2.23.2-63.el7 libpcap.x86_64 14:1.5.3-12.el7
libselinux.x86_64 0:2.5-15.el7 libselinux-python.x86_64 0:2.5-15.el7
libselinux-utils.x86_64 0:2.5-15.el7 libsmartcols.x86_64 0:2.23.2-63.el7
libss.x86_64 0:1.42.9-17.el7 libuuid.x86_64 0:2.23.2-63.el7
util-linux.x86_64 0:2.23.2-63.el7
Complete!
[root@VM-16-3-centos ~]#
5、解压后的python3包移动到python36目录下。(要清楚cp与mv的区别)
[root@VM-16-3-centos ~]# ll
total 4437992
-rw-r--r-- 1 root root 4521459712 Aug 10 20:57 CentOS-7-x86_64-DVD-1708.iso
drwxr-xr-x 2 root root 4096 Aug 18 11:22 python36
drwxr-xr-x 17 501 501 4096 Dec 24 2018 Python-3.6.8
-rw-r--r-- 1 root root 23010188 Dec 24 2018 Python-3.6.8.tgz.1
-rw-r--r-- 1 root root 18479 Aug 18 11:46 wget-log
[root@VM-16-3-centos ~]# mv Python-3.6.8 python36/
[root@VM-16-3-centos ~]# cd python36/
[root@VM-16-3-centos python36]# ll
total 4
drwxr-xr-x 17 501 501 4096 Dec 24 2018 Python-3.6.8
[root@VM-16-3-centos python36]#
6、进入目录进行配置、编译和安装。(配置、编译和安装我没有明细出来,因为是在是太多,跑的也很慢。编译和安装可以一起命令是make && make install ,我这里没有一起用。)
[root@VM-16-3-centos Python-3.6.8]# ./configure --prefix=/root/python36 ##配置python3安装路径
[root@VM-16-3-centos Python-3.6.8]# make ##编译
[root@VM-16-3-centos Python-3.6.8]# make install ##安装
7、添加软连接。(我们设置软链接,直接让新安装的python3.6指向给 /usr/bin/python3 ,让 pip3 指向给/usr/bin/pip3)
[root@VM-16-3-centos Python-3.6.8]# ln -s /root/python36/bin/python3.6 /usr/bin/python3
[root@VM-16-3-centos Python-3.6.8]# ln -s /root/python36/bin/pip3 /usr/bin/pip3
8、最后的验证工作。(先查看下版本信息,后创建一个简单的python脚本做验证)
[root@VM-16-3-centos Python-3.6.8]# python3 --version ##查看python版本信息
Python 3.6.8
[root@VM-16-3-centos Python-3.6.8]# vi CJJ.py ##编辑一个python脚本文件注意文件结尾要以.py结尾
#!/usr/bin/python ##指定解释器
# -*- coding: UTF-8 -*- ##指定编码,我下面输出内容有中文,所以需要指定下UTF-8
print( "你好,世界,我是CJJ." ) ##python3和python2的语法格式要区分
:wq!
[root@VM-16-3-centos Python-3.6.8]# python CJJ.py ##执行.py结尾文件
你好,世界,我是CJJ. ##输出内容
ok,已经结束了,该说再见了。相信你通过以上信息,应该已经学会了python3的安装,让我们下次见。
C&JJ