Upgrade python2.7.X to Python3.6.X, and upgrade macpython2.7 to 3.6.
Upgrade python2.7.X to Python36.X
Install Python3
The project is encoded in the py3 environment, and the default Centos py version is 2. We also need to install py3 to run the program. Before that, we need to install the development kit, because you need to compile and install Python
[Root @ CentOS ~] # Yum-y group install "Development Tools"
Install the Python dependency package. If you do not install the dependency, you may not have pip3 software after installation.
[Root @ CentOS ~] # Yum-y install openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel vim
Download the latest Python3.5.x
[Root @ CentOS ~] # Wget https://www.python.org/ftp/python/3.5.3/Python-3.5.3.tgz
You may need to install wget through yum-y
Decompress, compile, and install
[Root @ CentOS ~] # Tar xf Python-3.5.3.tgz
[Root @ CentOS ~] # Cd Python-3.5.3
[Root @ CentOS Python-3.5.3] #./configure -- prefix =/usr/local/python3.5
[Root @ CentOS Python-3.5.3] # make
[Root @ CentOS Python-3.5.3] # make altinstall
Create links for pip3 and python3
[Root @ CentOS Python-3.5.3] # ln-fs/usr/local/python3.5/bin/python3/usr/local/bin/
[Root @ CentOS Python-3.5.3] # ln-fs/usr/local/python3.5/bin/pip3/usr/local/bin/
[Root @ CentOS Python-3.5.3] # mv/usr/bin/python/usr/bin/python_old
[Root @ CentOS Python-3.5.3] # ln-fs/usr/local/python3.5/bin/python3.5/usr/bin/python
[Root @ CentOS Python-3.5.3] # ln-fs/usr/local/python3.5/bin/pip3.5/usr/bin/pip
Verify Installation
[Root @ CentOS Python-3.5.3] # Rip-V
Pip 9.0.1 from/usr/local/python3.5/lib/python3.5/site-packages (python 3.5)
[Root @ CentOS Python-3.5.3] # python-V
Python 3.5.3
Modify the yum file. Otherwise, yum cannot be downloaded.
Vim/usr/bin/yum
#! /Usr/bin/python #! /Usr/bin/python2.7 save to take effect