CentOS7 installed by default python2.7.5, when you need to use Python3, you can manually download the Python source code after compiling the installation.
1. The dependencies that may be used to install python3.5
1 yum install openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel
2. Download Python
wget "Https://www.python.org/ftp/python/3.5.0/Python-3.5.0.tgz"
3. Unzip the downloaded compressed package
TAR-ZXVF python-3.5.0.tgz
4. Configuring the Compilation
1 sudo mkdir/usr/local/python3
2 sudo python-3.5.0/configure--prefix=/usr/local/python3
3 sudo make
4 sudo make install
5. Back up the old version of Python, link the new version of Python
In/usr/bin python, Python2, python2.7 three files pointing to the latter
1 sudo mv Python python.bak,
2 sudo ln-s/usr/local/python3/bin/python3/usr/bin/python
6. Modifying the Yum configuration file
sudo vi/usr/bin/yum
Change the python version specified in the first line to python2.7 (#!/usr/bin/python to #!/usr/bin/python2.7)
CentOS 7 installs Python3.5 and is compatible with Python2.7