Installing Python on Windows, macOS and Linux
This lesson is boring and you cannot skip it. Installation is also where a surprising number of people quietly give up, usually because of one of two problems that this lesson will steer you around.
Pick your operating system below and ignore the others.
Windows
Do not install from the Microsoft Store. It works, mostly, until it does not, and the failures are confusing. Use the official installer.
- Go to python.org/downloads and click the big yellow Download Python 3.x button.
- Run the downloaded
.exe. - Tick "Add python.exe to PATH" at the bottom of the first screen. This is
the single most important click in this lesson. If you miss it, your terminal
will tell you
pythonis not recognised, and the fix is to run the installer again. - Click Install Now and wait.
To check it worked, open a new terminal — press Win + R,
type powershell, press Enter — and run:
python --version
You should see something like Python 3.12.4. The exact numbers do not matter
as long as it starts with 3.12 or higher.
If you get 'python' is not recognized..., the PATH box was not ticked. Run the
installer again, choose Modify, and make sure the PATH option is selected.
macOS
macOS ships with an old Python that Apple uses for its own purposes. Leave it alone and install your own alongside it.
The simplest route is the official installer:
- Go to python.org/downloads, download the macOS installer, and run it.
- Accept the defaults.
Then open Terminal (Cmd + Space, type "Terminal") and run:
python3 --version
Note the 3. On macOS, python may point at Apple's old version or at
nothing at all; python3 is the one you installed. Use python3 everywhere in
this course.
If you already use Homebrew, brew install python works just as well.
Linux
Most distributions already have Python 3. Check first:
python3 --version
If it prints 3.12 or newer, you are done. If it is older or missing, install it.
On Ubuntu or Debian:
sudo apt update
sudo apt install python3 python3-pip python3-venv
On Fedora:
sudo dnf install python3 python3-pip
The python3-venv package on Ubuntu matters later, in the module on virtual
environments. Installing it now saves a confusing error then.
The two commands you need to remember
Whatever your system, there are two things Python gives you:
python(Windows) orpython3(macOS and Linux) — runs your code.piporpip3— installs other people's code.
Check pip is there too:
pip --version
If pip is missing but Python works, try python -m pip --version instead —
that form works even when pip itself is not on your PATH, and it is the more
reliable way to call it.
Throughout this course, commands are written as
python. On macOS and Linux, typepython3instead. It is the same program.
When it does not work
'python' is not recognized on Windows. The PATH box. Re-run the installer
and choose Modify. Then close your terminal and open a new one — a terminal
reads PATH when it starts and will not notice the change until you restart it.
python opens the Microsoft Store. Windows ships a placeholder that does
this when no real Python is installed. Install from python.org, then search
"Manage app execution aliases" in Windows settings and switch off the entries for
python.exe and python3.exe.
command not found: python on macOS. Use python3. This is normal and not
a mistake on your part.
permission denied on Linux. You are missing sudo in front of the install
command.
Two versions installed and confusion about which is running. Ask it directly:
python -c "import sys; print(sys.executable)"
That prints the full path of the Python that is actually running. When something strange happens later — a package you installed is "not found" — this command is usually how you work out why.
Practice
- Install Python and confirm
python --version(orpython3 --version) prints 3.12 or newer. - Confirm
pip --versionworks. - Run
python -c "print(2 + 2)"and check that it prints4. That is a complete Python program run from the terminal.
If any of the three failed, fix it before moving on. Everything after this assumes a working install, and pushing forward with a broken one wastes hours.
Next: setting up an editor so you are not writing code in Notepad.
Stuck on this lesson?
Being stuck is part of it — but being stuck alone for three days is not. Our internship programme pairs this curriculum with code review and one-to-one help from working developers, and it is free.
About the internship