How to Install Python

Get Python onto your own computer

Beginner 9 min

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:

Example
python3 --version
Output
Python 3.13.0
Confirm the interpreter is installed and see its version.

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.

Example
python3 -c "print(1 + 1)"
Output
2
After installing, run a one-off snippet to prove it works.

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

Why it happens:

The checkbox is easy to miss, and without it the terminal can’t find the python command even though Python is installed.

How to fix it:

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?

You see ‘python: command not found’. What is the most likely cause?

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")

What to learn next

You learned how to check for an existing interpreter, install Python cleanly on Windows, macOS, or Linux, tell python from python3, and fix the classic PATH problem. You also asked Python its own version straight from code by printing sys.version.

With Python installed, the obvious next question is how to actually run code with it. Running Python Code covers the two ways that matter: the interactive REPL for quick experiments, and .py files for programs you keep. When you’re ready, continue to the next lesson.