The Setup Lab

Set up your Python lab ๐Ÿ”ง

Ten minutes, once. Pick your operating system below. Every step says what to type, what you should see, and what to do when you see something else instead.

๐Ÿงช You do not need any of this to start Every example in Levels 1 and 2 runs in your browser, and the Playground is a complete editor with nothing installed. Come back here when you want to work with real files on your own machine, which is around Lesson 21.

Windows

  1. Download the installer. Go to python.org/downloads and press the big yellow button. It detects Windows automatically.
  2. Tick the box. This is the whole lesson. On the first installer screen there is a checkbox at the bottom: "Add python.exe to PATH". Tick it. If you miss it, the terminal will not find Python and you will spend an hour confused. Then press "Install Now".
    ๐Ÿชค Ninety percent of Windows setup pain is that unticked box. If you already installed without it, re-run the installer, choose "Modify", and add it.
  3. Open PowerShell. Press Start, type powershell, press Enter.
  4. Check it worked.
    PS C:\Users\you> python --version
    Python 3.13.5
    Any 3.11 or newer is fine.
  5. Check pip too. pip installs other people's code and comes with Python.
    PS C:\Users\you> pip --version
    pip 25.0 from C:\... (python 3.13)
๐Ÿช A note on the Microsoft Store version

Typing python on a fresh Windows sometimes opens the Store. That is a placeholder, not Python. Install from python.org instead: the Store build sandboxes file access in ways that will confuse you later.

macOS

  1. Do not use the Python that is already there. macOS ships an old Python for its own use. Leave it alone.
  2. Install a real one. Either download from python.org/downloads and run the .pkg, or if you use Homebrew:
    brew install python@3.13
  3. Open Terminal. Cmd+Space, type terminal, Enter.
  4. Check it.
    $ python3 --version
    Python 3.13.5
    Always python3 with the 3, on macOS.
  5. Check pip.
    $ python3 -m pip --version
    pip 25.0 from /opt/homebrew/... (python 3.13)
    Using python3 -m pip rather than bare pip guarantees you are installing into the same Python you are running. Make it a habit.

Linux

It is already installed. Check which version:

$ python3 --version
Python 3.12.3

If it is older than 3.11, or pip and venv are missing:

# Debian, Ubuntu, Mint
sudo apt update && sudo apt install python3 python3-pip python3-venv

# Fedora
sudo dnf install python3 python3-pip

# Arch
sudo pacman -S python python-pip
๐Ÿง Do not fight your system Python

On Linux the system Python belongs to your package manager, and installing things into it with sudo pip can break system tools. Newer distros block it outright with an externally-managed-environment error. That error is protecting you. Use a virtual environment (Lesson 26); it is two commands and it makes the problem disappear forever.

An editor that helps you

Take VS Code unless you have a reason not to. It is free, runs everywhere, and every tutorial on earth assumes it.

  1. Install VS Code from the link above.
  2. Install the Python extension. Open the Extensions panel (the blocks icon in the sidebar), search "Python", install the one published by Microsoft. You get colouring, error squiggles, autocomplete and a Run button.
  3. Open a folder, not a file. File, Open Folder, choose your python-school folder. This one habit prevents a surprising amount of confusion later.
  4. Pick your interpreter. Press Ctrl+Shift+P (Cmd+Shift+P on Mac), type "Python: Select Interpreter", choose the 3.13 you just installed.
  5. Turn on format-on-save once you reach Lesson 30. Settings, search "format on save", tick it. Never argue about spacing again.
โŒจ๏ธ The four shortcuts worth memorising

Ctrl+S save. Ctrl+/ comment out the selected lines. Ctrl+Shift+P the command palette, which can do everything. Ctrl+` opens a terminal inside the editor, already standing in your project folder. On a Mac, Cmd instead of Ctrl.

When it breaks

What you seeWhat it meansWhat to do
command not found: python3
'python' is not recognized
The shell cannot find PythonWindows: reinstall with 'Add to PATH' ticked. All: close and reopen the terminal after installing
can't open file 'hello.py'You are not in the folder that holds the fileRun ls (or dir) and look. cd to the right folder
SyntaxError: invalid syntaxA typo. Very often a missing bracket or quote on the line ABOVE the one namedRead the line number, then look one line up. Lesson 10 covers this properly
IndentationErrorYour spacing is inconsistentUse four spaces per level, never tabs. In VS Code: 'Convert Indentation to Spaces'
ModuleNotFoundError: No module named 'x'That package is not installed in the Python you are runningpython3 -m pip install x, and see Lesson 26 on virtual environments
externally-managed-environmentLinux is protecting its system PythonMake a virtual environment: python3 -m venv .venv then activate it
Two Pythons, wrong one runsPATH orderwhich python3 (macOS/Linux) or where python (Windows) shows which one wins

The universal check

When anything is confusing, ask Python itself which Python is talking:

import sys
print(sys.version)
print(sys.executable)

That prints the exact version and the exact file being run. Nine times out of ten, "it works in my editor but not my terminal" is those two lines disagreeing.

Prove the lab works

Make a file called hello.py, put this in it, and run python3 hello.py:

import sys

print("Python is installed and working.")
print(f"Version: {sys.version.split()[0]}")
print("Lab status: operational. Go and learn something.")

Three lines of output means you are done. Go to Level 1.