1. Download #wget wget https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tgz
2. Unzip and install
#tar zxvf python-3.6.1.tgz#cd python-3.6.1#./configure --prefix=/var/local/ Python appears configure: error: no acceptable c compiler found in $PATHyum install gcc -y appears zipimport. Zipimporterror: can ' t decompress data; zlib not available Workaround: 1, install dependent zlib, ZLIB-DEVEL  YUM -Y INSTALL ZLIB-DEVEL2, recompile installation python./configure edit Modules/setup file Find the following sentence, remove the comment #zlib zlibmodule.c -i$ (prefix)/include -l$ (exec_prefix)/lib -lz RECOMPILE installation: #make && make install
3. This is already installed in/var/local/python3, but the input #python--version shows the original python, the original Python file is in/usr/local/bin. There are two ways to do this: soft joins and direct replacements. Here I was directly replaced.
If it is a soft connection, you can try using the #ln-fs/usr/local/src/python-3.6.1/python/usr/bin/python
CentOS Python3 version replaces Python2 version