As of this time, the latest version of Python on the Python website is Python3.8.4. Because centos7.x is the default Python2.7 environment on cloud servers, it is now common to use Python3 or higher as the development environment.



Here are the ways to exit the Python command line:

  1. Type exit() and press Enter
  2. Enter quit() and press Enter
  3. Press CTRL + z directly
  • First go to the Python website to download the Python package

  • Each version provides three download links, in order of a Web-based installer, an executable installer, and a compressed file for the program. You usually choose to download an executable installer. Select Windows X86 for a 32-bit operating system and Windows x86-64 for a 64-bit operating system. Gzipped Source Tarball, source, file for TGZ, Liunx installation.

To put this in perspective: x86 is 32-bit, x86-64 is 64-bit. AMD64, or “X64,” is a 64-bit computer processor architecture. EM64T, CPU uses IA-32 instruction set, EM64T is an extension on the basis of this instruction set.

Installation method: Web-based Installer, which needs to be installed over the network. Executable installer (*.exe) Embeddable zip file, an embedded version that can be integrated into other applications.

  • Such as: www.python.org/ftp/python/… Choose the appropriate version for your computer. Here we go into the python versions available in the image above.



  • When the download is complete, unzip it.
  • Dependent environment required by the installation
yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlitedevel readline-devel tk-devel gcc make
Copy the code
  • Create a Python folder in /usr/local/python-3.8.4
mkdir /usr/local/python
cd /usr/local/ Python - 3.8.4. / configure the prefix = / usr /local/python3
make && make install
Copy the code
  • Configure PYTHon3, add global variables (recommended), of course you can use soft links (but python3 and PIp3 need to be connected), not recommended, here is how to add PYTHon3 to environment variables.

  • First missing the path to bin in PYTHon3, then open the environment variables file
vim /etc/profile
Copy the code
  • Add the root directory where python3 resides:
export PYTHON=/usr/local/python3
Copy the code
  • Import the environment variable directly before $PATH
export PATH=$PYTHON/bin:$PATH
Copy the code

For example: This is the variable of each environment THAT I configured, in fact, the form is similar.

Here the “:” represents the delimiter, and $PATH represents the current variable

  • Reload the configuration to take effect
source /etc/profile
Copy the code
  • To verify success, type PYTHon3



  • If you type Python, the environment is still Python2.7.5