First, a Short Reality Check
You don't actually need to install anything to write your first lines of Python. The editors embedded in these docs run real Python code in your browser, and you can keep going for a while on that alone. Installing Python locally is the moment you want to save files on your own machine, run longer programs, or use libraries that don't come pre-bundled.
If you'd rather skip straight to writing code, jump to the next page. If you're ready to install, read on.
Check Whether Python Is Already There
Before installing anything, check what you already have. Open a terminal — Command Prompt or PowerShell on Windows, Terminal on macOS, your shell of choice on Linux — and type:
python --version
If that says "command not found," try python3 --version. On macOS and most Linux distributions you'll probably see something like Python 3.12.6 already. If the number starts with 3., you're in good shape.
If you see Python 2. something, treat it as if Python isn't installed. Python 2 reached end-of-life in 2020 and shouldn't be used for new code.
Installing on Windows
- Go to python.org/downloads.
- Click the big yellow "Download Python 3.x.x" button. It detects Windows automatically.
- Open the installer. Before clicking Install Now, tick the box that says "Add python.exe to PATH" at the bottom of the window. This is the single most important step — without it,
pythonwon't work from your terminal. - Click "Install Now" and wait a minute. The installer handles the rest.
- Open a new PowerShell or Command Prompt window (old ones won't have the updated PATH) and run
python --version. You should see the version you just installed.
If you forgot to tick the PATH box, the easiest fix is to run the installer again, click "Modify," and add it after the fact.
Installing on macOS
You have two good options. Pick one; don't mix them.
Option A: the python.org installer. Download it from python.org/downloads, open the .pkg file, and follow the prompts. When it's done, python3 and pip3 will be available in your terminal.
Option B: Homebrew. If you already use Homebrew for other tools:
brew install python
Homebrew keeps Python up to date when you run brew upgrade, which is why many developers prefer it. Whichever route you pick, verify the install:
python3 --version
On macOS, always reach for python3 and pip3 rather than bare python and pip. The bare commands sometimes point at an old system Python you shouldn't touch.
Installing on Linux
Most distributions ship with Python 3 already. Run python3 --version first to check. If you need to install or upgrade, use your package manager:
- Debian / Ubuntu:
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
The python3-venv package (or your distro's equivalent) is worth grabbing up front — you'll use virtual environments as soon as you start installing libraries.
Verifying the Install With Real Code
Once the terminal reports a sensible version number, try running a tiny program end-to-end. In your terminal:
python3
That drops you into Python's interactive mode — a prompt that looks like >>>. Type a line and hit enter:
>>> print("installed")
installed
>>> 2 + 2
4
>>> exit()
If you see the output rather than an error, you're done. You can exit the interactive session with exit() or Ctrl-D.
And if you just want to test without touching your terminal, here's a runnable snippet that behaves exactly like the lines above:
When Something Goes Wrong
pythonopens the Microsoft Store on Windows. This happens when you skipped the "Add to PATH" step and Windows is trying to help. Re-run the installer, click Modify, and add Python to PATH.pipnot found. On macOS and Linux, trypip3instead. On Windows,pipshould work if Python is on your PATH; otherwise, usepython -m pip ...as a reliable fallback.- Multiple Python versions feel confusing. That's normal, and managing them is exactly what virtual environments are for. We'll cover those in a later chapter.
You're Ready
With a working python3 command and a version number you can live with, you're set up for the next step: actually running a script you wrote yourself. That's next.
Frequently Asked Questions
How do I install Python?
Download the installer from python.org, run it, and — on Windows — check the box labeled 'Add Python to PATH' before clicking Install. On macOS and Linux, Python is often already available; you usually just need to install a newer version alongside the system one.
How do I check my Python version?
Open a terminal and run python --version or python3 --version. If you get a number like 3.12.2, you have Python installed. If you get a command-not-found error, you still need to install it.
Do I need to install Python to learn it?
No. You can run Python right in your browser on sites like Coddy, including the interactive editors on these docs. Installing locally is useful once you want to save projects, work with files on your computer, or use libraries — but it's not a prerequisite for the first few lessons.
Which version of Python should I install?
Whatever the current stable release of Python 3 is — python.org highlights it on the front page. Any recent Python 3 version is fine for learning; you don't need to match a specific minor version. Avoid Python 2 — it was retired years ago and no longer receives security updates.