In this lesson: Have a working Python on your own machine and prove it from the terminal.
Python is a free program that reads instructions you write and carries them out. Nothing here costs money. Follow the section for your own computer, then do the verification step at the end — do not skip it.
Windows
- Go to python.org, open the Downloads menu and click the button for the latest Python 3.
- Run the downloaded file.
- On the very first screen, tick "Add python.exe to PATH". It is a small checkbox at the bottom and it is easy to miss. This single tick is the difference between Python working and hours of confusion.
- Click Install Now and wait.
- Open the Start menu, type
cmd, press Enter. A black window opens — this is the terminal.
macOS
- macOS ships an old Python that you should leave alone. Install your own.
- Download the macOS installer from python.org and run it, or if you already use Homebrew run
brew install python. - Open Terminal (Command+Space, type "terminal", Enter).
- On macOS the command is
python3, notpython. Remember that everywhere below.
Linux (Ubuntu, Debian)
Python 3 is already there. Add the two pieces that are usually missing:
sudo apt update
sudo apt install python3 python3-pip python3-venv
Verify it — everyone does this
In the terminal, type this and press Enter:
python --version # Windows
python3 --version # macOS and Linux
You should see something like Python 3.12.4. Any 3.x version is fine for this whole track.
Now check pip, the tool that installs extra packages:
pip --version # Windows
pip3 --version # macOS and Linux
When it says "command not found"
This almost always means one of three things:
- You are on Windows and did not tick "Add to PATH" — fix with Modify, above.
- You are on macOS or Linux and typed
pythoninstead ofpython3. - You opened the terminal before installing. Close it and open a new one — a terminal only reads its settings when it starts.
An editor to write in
Code is plain text, so any text editor works, but a code editor colours your code and points at mistakes. Install Visual Studio Code (free, from code.visualstudio.com). After it opens:
- Click the Extensions icon in the left bar (four squares).
- Search for Python, publisher Microsoft, and click Install.
Do not use a word processor or a phone notes app. They insert invisible formatting and curly quotation marks that Python cannot read.
Try it yourself
Run the two verification commands and write the version numbers in your notebook. Then type python (or python3) on its own and press Enter — you will see >>>, which means Python is now listening. Type 2 + 2, press Enter, and you have run your first Python. Type exit() to leave.