How to Install Python
Get Python onto your own computer
In this lesson
To run your own .py files on your computer, you first need to install Python. This lesson shows you how to check whether it’s already there, download and install it cleanly, and confirm it works from a terminal — on Windows, macOS, or Linux.
Explain it like I’m 5
Python is a program your computer runs. Installing it is like installing any app — afterwards your computer knows what to do when you say ‘run this Python file’.
The interpreter, and checking if you already have it
When you ‘install Python’, you’re installing the interpreter — the program that reads and runs your code. Many Macs and Linux machines already include one. Open a terminal (Command Prompt or PowerShell on Windows; Terminal on macOS/Linux) and try:
python3 --version
Python 3.13.0
python vs python3
For historical reasons there are two command names. On macOS and most Linux systems, python3 is the modern Python 3, while plain python may be missing or point at an ancient version. On Windows, the installer usually sets up python. Rule of thumb: try python3 first; if that’s ‘not found’, try python.
Installing it
Windows / macOS: download the latest installer from python.org/downloads and run it. On Windows, tick “Add Python to PATH” on the first screen — this is the single most important checkbox. Linux: use your package manager, e.g. sudo apt install python3 on Debian/Ubuntu.
python3 -c "print(1 + 1)"
2
The PATH, and ‘command not found’
Your terminal finds programs by searching a list of folders called the PATH. ‘python: command not found’ usually means Python isn’t on the PATH, not that it’s missing. On Windows, re-run the installer and tick ‘Add Python to PATH’, or use the py launcher. After changing PATH, close and reopen the terminal.
You’ll also want a code editor
Installing Python gives you the engine that runs code. To comfortably write code, you’ll also want a code editor — a program that colours your syntax, flags mistakes as you type, and gives you a run button.
Good free choices: VS Code (the most popular, with a Python extension), PyCharm Community, and IDLE, which ships with Python so it’s already on your machine. You can technically write Python in any plain-text editor, but a real code editor makes the experience far smoother. Once you’ve picked one, the next lesson shows the different ways to actually run your code.
Common mistake: Forgetting ‘Add Python to PATH’ on Windows
The checkbox is easy to miss, and without it the terminal can’t find the python command even though Python is installed.
Re-run the installer, choose ‘Modify’, and enable ‘Add Python to PATH’ — or just use the py launcher. Reopen your terminal afterwards.
What does `python3 --version` do?
It just reports the version and exits — a quick way to confirm Python is available.
You see ‘python: command not found’. What is the most likely cause?
‘command not found’ is about locating the program, usually a PATH issue (or it isn’t installed).
Mini exercise (easy)
On your own computer, open a terminal and find which command works: python3 --version or python --version. Note the version number you get.
You can’t open a terminal here, but you can ask Python its version straight from code. Print sys.version.
import sys
# Print the running Python version:
print("version here")
Try python3 first on macOS/Linux; try python or py on Windows.
import sys
print(sys.version)