Install Python¶
Goal: get Python running on your computer and confirm it works.
Step 1: Download and install¶
- Go to python.org/downloads and click the big yellow Download Python button.
- Run the installer.
- Important: on the first screen, tick the box "Add python.exe to PATH" before clicking Install Now.
- Go to python.org/downloads and download the macOS installer.
- Open the
.pkgfile and follow the steps.
macOS ships with an old Python. Always use the one you just installed by typing python3, not python.
Step 2: Open a terminal¶
The terminal is a window where you type commands. You will use it to run your programs.
- Windows: press the Windows key, type
PowerShell, and press Enter. - macOS: press Cmd+Space, type
Terminal, and press Enter. - Linux: usually Ctrl+Alt+T.
Step 3: Check that Python works¶
Type this and press Enter:
On macOS or Linux use python3 --version instead. You should see something like:
Any version starting with 3.10 or higher is fine for this course.
Getting 'python is not recognized' on Windows?
The Add to PATH box was probably not ticked. Run the installer again, choose Modify, and make sure the option is enabled. Then close and reopen PowerShell.
Step 4: Install a code editor¶
Download and install Visual Studio Code. When it opens for the first time, install the Python extension by Microsoft from the Extensions panel on the left.
That is all the setup you need. Write your first program