How to Install Python on Windows, macOS, and Linux
Why do I need to install Python?
You need to install Python on your PC because your computer doesn't understand Python by default. When you install Python software, it comes with a Python interpreter. This interpreter converts or translates Python code into machine code (Tooltip: Machine code is the lowest-level programming language, consisting of binary digits 0 and 1), which computers can understand and execute.
Install Python in Windows
This video demonstrates how to install Python on Windows: https://www.youtube.com/watch?v=NES0LRUFMBE
Step by Step:
- Download Python for Windows from Python.org
- Open the downloaded .exe file
- Tick the Add Python to PATH checkbox at the bottom
- Then click Install Now
- Now wait for the installation. When installed, click Finish
Verify Installation:
To check if Python has successfully installed on your Windows:
- Open Command Prompt by pressing Windows + R
- Type cmd and press Enter
- Now type:
python --version
If installed correctly, you will see something like:
Python 3.x.x
In the same Command Prompt, type:
python
You should see:
>>>
Now Python is ready to use.
Common Mistake (Important)
If you see:
'python' is not recognized
That means you forgot to tick Add Python to PATH.
- Reinstall Python and make sure to tick that option
Install Python in Mac
This video demonstrates how to install Python on Mac: https://www.youtube.com/watch?v=NES0LRUFMBE
Step by Step:
- Download Python for Mac from Python.org
- Open the downloaded .pkg file
- Follow the on-screen instructions and click Continue through each step
- Click Agree to accept the license
- Click Install and enter your Mac password if asked
- When installation is done, click Close
Verify Installation:
To check if Python has successfully installed on your Mac:
- Open Terminal by pressing Command + Space, typing Terminal, and pressing Enter
- Now type:
python3 --version
If installed correctly, you will see something like:
Python 3.x.x
In the same Terminal, type:
python3
You should see:
>>>
Now Python is ready to use.
Note: On Mac, you use python3 instead of python. This is completely normal.
Install Python in Linux
This video demonstrates how to install Python on Linux: https://www.youtube.com/watch?v=NES0LRUFMBE
Most Linux systems already come with Python pre-installed. Let's check first before installing.
Check if Python is already installed:
- Open your Terminal
- Type:
python3 --version
If you see a version number, Python is already installed and you're good to go!
If not, follow the steps below.
Step by Step:
- Open your Terminal
- Type the following command and press Enter:
sudo apt install python3
- Enter your password when asked
- Type Y and press Enter to confirm
- Wait for the installation to finish
Verify Installation:
Once installed, type:
python3 --version
If installed correctly, you will see something like:
Python 3.x.x
In the same Terminal, type:
python3
You should see:
>>>
Now Python is ready to use.
Note: The command above works for Ubuntu and Debian-based Linux. If you use a different Linux version, the command may be slightly different.
Use Python Online
Alternatively, you can use our Online Python Compiler to write and execute any Python code instantly. This works on all devices (Mobile, Tablet, PC).