Windows Section

First Step

Search for Python on baidu, or go directly to the Python official website [https://www.python.org](https://www.python.org/]

img

Second Step

Find the Download button at the top of the webpage, hover the mouse over it (Note: Do not click), and select the Windows version

img

img

Third Step

Choose the latest stable version on the page, find Download Windows x86-64 executable installer, and note that it must be the installer for automatic installation

img

Click directly to download

Fourth Step

Double-click to install

img

On the installation interface, make sure to check the box Add Python to PATH, then click Install Now

img

Wait for the installation to complete, and click Close on the final interface

img

Testing

Write a program to test it

img

Nice!

Linux Section

First Step

Enter the following command to update the software source.

1
sudo apt-get update

This command is applicable for Ubuntu\Debian (remove sudo if needed)

Second Step

Enter the following command to install Python.

1
sudo apt-get install python3

This command is applicable for Ubuntu\Debian (remove sudo). If installation fails, consider changing the Linux source.

1
yum install python3

This command is applicable for CentOS

Third Step

Enter Python3 to check the installed version

1
python3 -V

Fourth Step

Common commands for Linux

1
2
3
touch new.py # Create a new Python program
vim new.py # Use the vim compiler to write code
python new.py # Run the Python program

If the system does not have vim, use the following commands to install

1
2
sudo apt-get install vim   # Ubuntu
yum install vim # CentOS

The usage of vim can be checked independently. I believe, those familiar with Linux are not unfamiliar with vim

Fifth Step

When writing a Python program, make sure to add the following code at the beginning of the program to indicate the directory of the Python interpreter.

1
2
#!/usr/bin/env python
# -*- coding: UTF-8 -*-