Because CENTOS7 originally installed the Python2, and this Python2 can not be deleted, because there are many system commands, such as Yum to use.
[Email Protected]_105_217_centos python-3.6.2]# Pythonpython 2.7.5 (default, 4, 00:39:18) [GCC 4.8.5 20150623 (Red Hat 4.8.5-16)] on Linux2type ' help ', ' copyright ', ' credits ' or ' license ' for more information.
Enter the python command to see what you know is the Python2.7.5 version
Input
which Python
You can view the location, which is typically located in the/usr/bin/python directory.
The following describes how to install Python3
Install the dependency package first
Yum-y Groupinstall "Development tools" Yum-y install Zlib-devel bzip2-devel openssl-devel ncurses-devel Sqlite-devel Read Line-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel
Then according to their own needs to download different versions of Python3, I downloaded the Python3.6.2
wget HTTPS://WWW.PYTHON.ORG/FTP/PYTHON/3.6.2/PYTHON-3.6.2.TAR.XZ
If the speed is not fast enough, you can go directly to the official website to download, using WINSCP and other software to the designated location on the server, my storage directory is/usr/local/python3, using the command:
Create an empty folder
Then unzip the package, enter the directory, install Python3
TAR-XVJF Python-3.6.2.tar.xz
CD Python-3.6.2
./configure--prefix=/usr/local/python3
Make && make install
Finally create a soft link
Ln-s/usr/local/python3/bin/python3/usr/bin/python3ln-s/USR/LOCAL/PYTHON3/BIN/PIP3/USR/BIN/PIP3
Enter the Python3 test on the command line
Centos7 How to install Python3