Install and run Python
RequiredRequired
Install a current Python 3 (3.12 or newer is a good default) and learn the two ways to run code: the interactive interpreter and a script file.
Installing
- Windows and macOS: the installer from python.org works. On Windows, tick Add python.exe to PATH.
- Linux: your distribution ships Python, but it belongs to the system. Do not install packages into it.
- Several versions: a version manager such as
uv(uv python install 3.13) orpyenvkeeps them side by side, so each project can pin its own.
Check it with:
python3 --version
Two ways to run code
The REPL (Read, Eval, Print, Loop) runs one line at a time and prints each result. It is perfect for trying things out:
$ python3
>>> 2 ** 10
1024
>>> exit()
A script is a .py file run from top to bottom:
# hello.py
name = "Ada"
print(f"Hello, {name}")
python3 hello.py
Use the REPL to explore and scripts for anything you want to keep.