Introduction

Python is a cross-platform application that runs on Windows, Mac and various Linux / Unix systems. Writing Python programs on Windows can also run on Linux.

Install Python 3.8

Currently, there are two versions of Python, one is the 2.x version and the other is the 3.x version. These two versions are not compatible. As the 3.x version becomes more and more popular, our tutorial will be based on the latest Python 3.8 version. Please make sure that the version of Python installed on your computer is the latest 3.8.x, so that you can learn this tutorial painlessly.

Install on MacOS

If you are using a Mac and the system is OS X> = 10.9, then the system comes with Python version 2.7. To install the latest Python 3.8, there are two methods:

  • Download the Python 3.8 installer from the Python official website, double-click to run and install after downloading;
  • If Homebrew is installed, you can directly install it by using the command brew install python3.

Install on Linux

If you are using Linux, I can assume that you have experience in Linux system management. Installing Python 3 by yourself should be fine. Otherwise, please switch back to Windows.
If you currently use Windows heavily and don't plan to change Mac anytime soon, you can continue reading the following.

Install on Windows

First, download the 64-bit installer or 32-bit installer corresponding to Python 3.8 from the official Python website according to your version of Windows (64-bit or 32-bit), and then run the downloaded exe installation package:

Pay special attention to the checkbox Add Python 3.8 to PATH, and then click "Install Now" to complete the installation.

Run Python

After the installation is successful, open a command prompt window and type python. There will be two cases:

  • Case 1:

Seeing the above screen, Python installation is successful!
When you see the prompt >>>, it means that we are already in the Python interactive environment. You can enter any Python code and you will get the execution result immediately after you press Enter. Now, type exit () and press Enter to exit the Python interactive environment (you can also close the command line window directly).

  • Case 2: get an error

This is because Windows will look for python.exe according to the path set by the Path environment variable. If it does not find it, it will report an error. If you missed the checkbox of Add Python 3.8 to PATH during installation, you must manually add the path where python.exe is located to Path.
If you don't know how to modify the environment variables, it is recommended to run the Python installer again. Be sure to check Add Python 3.8 to PATH.

summary

  • Learn how to install Python on your computer and become proficient at opening and exiting the Python interactive environment.
  • When running Python on Windows, start the command line first and then run python.
  • When running Python on Mac and Linux, open a terminal and run python3.
Last modified: January 8, 2020

Author

Comments

Leave a Reply