Python Module 1 – Getting started: install, run and read Python
Install Python 3.14 on Windows, macOS and Linux
Install Python 3.14 on Windows, macOS or Linux, check which interpreter your terminal really runs, and fix the PATH problems behind "command not found".
What you will learn
- Install Python 3.14 from python.org or your platform's recommended source
- Verify the installation from a terminal and fix PATH problems
- Choose between the py, python and python3 commands on each platform
Before you start
On this page
To follow this track on your own computer you need Python 3.14 or newer. Installing takes a few minutes; the part people get stuck on is making sure the terminal runs the Python you just installed, so this lesson spends as much time on checking as on installing.
Note
No installation yet? Most examples in this track also run in your browser, in this site’s Python Online Compiler, with nothing to install. A lesson says so when one of its examples needs Python on your own computer.
First, check what you already have
Open a terminal: Terminal on macOS, your distribution’s terminal on Linux, Windows Terminal or PowerShell on Windows. Then ask Python for its version:
- macOS and Linux:
python3 --version - Windows:
py --version(orpython --version)
If it prints Python 3.14 followed by a bugfix number, or anything newer, skip to
Check which Python runs. If it prints an older version, or the command is not found,
install 3.14 as described for your system.
Windows
The Python documentation for Windows recommends the Python install manager, which you get from
python.org or the Microsoft Store. It gives you the py command (and python),
which installs and runs Python versions side by side:
py install 3.14installs the latest Python 3.14.py listshows the versions that are installed.py script.pyruns a script with the default version.
Open a new terminal window after installing, so it picks up the new commands. If typing python opens the
Microsoft Store instead of starting Python, use py, or turn off the python.exe entries under App execution
aliases in Windows Settings.
macOS
A python3 command may already exist on your Mac, but it is often an older Python that came with Apple’s developer
tools. Install 3.14 next to it; do not try to remove the old one.
- python.org installer: download the macOS installer for Python 3.14 from
python.org/downloads and run it. It adds the
python3andpython3.14commands. - A package manager, if you already use one, for example Homebrew:
brew install python@3.14.
Afterwards, open a new Terminal window and check the version again.
Linux
Most Linux distributions include a Python 3 that the system’s own tools depend on. Never remove or replace it: parts of the system can stop working. Install the version you need alongside it instead:
- from your distribution’s packages, if it offers Python 3.14;
- with a version manager (below), which installs any exact version in your home folder;
- or by building it from source, as the Python documentation describes.
Version managers (any system)
A version manager installs exact versions, keeps several side by side, and lets each project choose one. Three widely used ones:
- uv (a later lesson covers it):
uv python install 3.14 - mise:
mise install python@3.14.8. This track’s examples are run withmise exec python@3.14.8 -- python3. - pyenv (macOS and Linux):
pyenv install 3.14.8
Which way to choose
| Criterion | python.org | Your package manager | A version manager |
|---|---|---|---|
| You choose the exact bugfix release | Yes | No: you get the version it packages | Yes |
| Several versions side by side | Yes | Sometimes, as separate packages | Yes, and each project can pick one |
| Updates | Install the next release yourself | With the rest of your system | Install the next release yourself |
| When to choose | You want the official build on Windows or macOS | You already install your tools with it | You work on several projects, or need one exact version |
Check which Python runs
Your terminal finds a command by looking through the folders listed in the PATH environment variable, in order,
and runs the first match. That explains the two common problems:
- Command not found: no folder on
PATHcontainspython3(orpy). Open a new terminal after installing; if the command is still not found, Python’s folder is not onPATHyet, and you need to add it in your shell’s or your system’s settings. - The wrong version runs: an older Python sits in a folder that comes earlier in
PATH.
Ask the interpreter where it lives with
python3 -c "import sys; print(sys.executable)". On macOS and Linux, which -a python3 lists every python3 on
your PATH in the order the terminal tries them; on Windows, where python does the same.
Then save this program as check_version.py and run it with python3 check_version.py (or py check_version.py):
import sys
minimum = (3, 14)
installed = sys.version.split()[0]
if sys.version_info >= minimum:
print("OK: Python", installed, "is new enough for this track.")
else:
print("This track needs Python 3.14 or newer, but this is Python", installed) Output
OK: Python 3.14.8 is new enough for this track.
Recorded with Python 3.14.8 on macOS 26 arm64. To run it yourself: mise exec python@3.14.8 -- python3 check_version.py
Runs on this device, in your browser. The first run downloads Python (about 13.5 MB), which is kept for the next runs.
Your run, in this browser
Version note
In your browser, the Python Online Compiler runs Pyodide 314.0.7, which contains CPython 3.14.2, so the message names 3.14.2. That is still Python 3.14, so the check passes there too.
In your browser, Pyodide 314.0.7 (CPython 3.14.2) prints:
OK: Python 3.14.2 is new enough for this track.
sys.version_info is the running interpreter’s version as a tuple of numbers, so comparing it with (3, 14) works
for every 3.14 bugfix release and every later version. On an older interpreter, such as Python 3.12, the same file
prints the second message instead.
Two extras you may meet
- Signed downloads. Release files on python.org can be checked with Sigstore; from Python 3.14 the release team no longer publishes PGP signatures (PEP 761). The python.org page on Sigstore explains how to verify a file, if you need to.
- Free-threaded Python. Python 3.14 also comes as a separate build without the global interpreter lock, called
3.14t(for examplepython3.14t). Ordinary programs do not need it; the concurrency module of this track explains when it helps.
Key takeaways
- On Windows, use the Python install manager and the
pycommand; on macOS, the python.org installer or a package manager; on Linux, install 3.14 alongside the system Python and never remove it. - After installing, open a new terminal and check the version with
python3 --versionorpy --version. PATHdecides which Python a command runs:sys.executableandwhich -a python3(orwhere python) show what you actually get.- Compare
sys.version_infowith a tuple, such as(3, 14), to check a minimum version in code.
Exercise
Exercise · Easy · Python
Check that a Python version is new enough
This lesson's check_version.py compares the running Python with (3, 14). Turn that check into a function you can test: check_version(version_info, minimum=(3, 14)).
- version_info is a tuple of whole numbers such as (3, 12, 4), the first three parts of sys.version_info. - Return "ok" when that version is minimum or newer. - Otherwise return a message that names the version found and the one to install, in exactly this form (for (3, 12, 4) and the default minimum): Python 3.12.4 is too old: install Python 3.14 or newer
Do not read sys.version_info inside the function: the tests pass made-up versions, so it must work with whatever it is given. Watch out for versions such as 3.9, which is older than 3.14 although "3.9" sorts after "3.14" as text.
Starter code · version_check.py
def check_version(version_info, minimum=(3, 14)):
"""Return "ok" when version_info is minimum or newer, otherwise a message saying which Python to install."""
return "ok" The sample tests · test_version_check.py
from version_check import check_version
def test_new_enough():
"""accepts 3.14 and every later version"""
assert check_version((3, 14, 8)) == "ok"
assert check_version((3, 15, 0)) == "ok"
assert check_version((4, 0, 0)) == "ok"
def test_exactly_the_minimum():
"""accepts a version equal to the minimum"""
assert check_version((3, 14, 0), minimum=(3, 14, 0)) == "ok"
def test_too_old():
"""names the version found and the one to install"""
assert check_version((3, 12, 4)) == "Python 3.12.4 is too old: install Python 3.14 or newer"
def test_numbers_not_text():
"""compares numbers, so 3.9 is older than 3.14"""
assert check_version((3, 9, 1)) == "Python 3.9.1 is too old: install Python 3.14 or newer"
def test_other_minimum():
"""uses the minimum it is given"""
assert check_version((3, 12, 4), minimum=(3, 12)) == "ok"
assert check_version((3, 11, 9), minimum=(3, 12)) == "Python 3.11.9 is too old: install Python 3.12 or newer" A hint
Tuples compare item by item, as numbers: (3, 9, 1) < (3, 14) is True. To build 3.12.4 from (3, 12, 4), turn each number into text and join them with dots: ".".join(str(part) for part in version_info).
Results of the sample tests
| Test | Result | Details |
|---|
What your code printed
The sample tests run on this device, in your browser (Pyodide): nothing is sent to mysmartcopilot.com. The first run downloads Python (about 13.5 MB), which is kept for the next runs. A check in your browser is feedback for you, not proof that the code is right for every input.
Check yourself
5 questions about this lesson. Every answer and why it is right is on the page, behind “Show the answer”. Your score stays in this browser.
References
- Using Python on Windows (Python Software Foundation)
- Using Python on macOS (Python Software Foundation)
- Using Python on Unix platforms (Python Software Foundation)
- Python downloads and Sigstore verification (Python Software Foundation)
- PEP 761: Deprecating PGP signatures for CPython artifacts (Python Software Foundation)
Related tools
Report a problem with this lesson
Kept only in this browser. Your Learn progress