Centos7 install Python3
Since centos7 originally installed Python2, and this Python2 cannot be deleted, because there are many system commands, such as yum, are used. `
[root@VM_105_217_centos Python-3.6.2]# 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.
which python can view the location, usually in the /usr/bin/python directory.
Here's how to install Python3
First install the dependencies
yum -y groupinstall “Development tools”
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
Then download different versions of Python3 according to your needs, I downloaded 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, use WinSCP and other software to transfer to the specified location on the server, my storage directory is /usr/local/python3, use the command:
mkdir /usr/local/python3
Create an empty folder
Then unzip the compressed package, enter the directory, and 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/python3
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
Enter python3 test in the command line
Reprinted from: http://www.cnblogs.com/FZfangzheng/p/7588944.html