Python Environment Installation Tutorial
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/]
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
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
Click directly to download
Fourth Step
Double-click to install
On the installation interface, make sure to check the box Add Python to PATH
, then click Install Now
Wait for the installation to complete, and click Close
on the final interface
Testing
Write a program to test it
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 | touch new.py # Create a new Python program |
If the system does not have vim
, use the following commands to install
1 | sudo apt-get install vim # Ubuntu |
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 | #!/usr/bin/env python |