Your country

Tools that support it use your country for local currency, number formats, units and paper size. Your choice is saved only in this browser.

Type a name or a two-letter code. Use the up and down arrow keys to move through the countries, Enter to choose one and Escape to close.

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".

  • Beginner
  • 20 minutes
  • Examples run with Python 3.14.8 and Pyodide 314.0.7
  • By MySmartCoPilot

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 (or python --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.14 installs the latest Python 3.14.
  • py list shows the versions that are installed.
  • py script.py runs 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 python3 and python3.14 commands.
  • 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 with mise exec python@3.14.8 -- python3.
  • pyenv (macOS and Linux): pyenv install 3.14.8

Which way to choose

Three ways to get Python 3.14
Criterion python.orgYour package managerA version manager
You choose the exact bugfix release YesNo: you get the version it packagesYes
Several versions side by side YesSometimes, as separate packagesYes, and each project can pick one
Updates Install the next release yourselfWith the rest of your systemInstall the next release yourself
When to choose You want the official build on Windows or macOSYou already install your tools with itYou 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 PATH contains python3 (or py). Open a new terminal after installing; if the command is still not found, Python’s folder is not on PATH yet, 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):

Is this Python new enough for the track? Python · 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

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 example python3.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 py command; 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 --version or py --version.
  • PATH decides which Python a command runs: sys.executable and which -a python3 (or where python) show what you actually get.
  • Compare sys.version_info with 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).

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.

  1. Question 1 of 5 On macOS or Linux, which command lists every python3 the terminal can find, in the order it tries them?

    Choose one answer.

    Show the answer to question 1

    Answer: which -a python3

    which -a python3 goes through the folders on PATH in order and prints each python3 it finds; the first one is what the command runs. python3 --version shows only the version of that first one, and py list is the Windows install manager's list.

  2. Question 2 of 5 Which of these are safe ways to get Python 3.14 on a Linux computer?

    Choose every answer that is right.

    Show the answer to question 2

    Answer:

    • Build it from source, as the Python documentation describes
    • Install it from your distribution's packages, if they offer 3.14
    • Install it with a version manager such as mise or pyenv

    Parts of a Linux system depend on the Python it came with, so it stays. Install the version you need next to it, from packages, with a version manager or from source.

  3. Question 3 of 5 Put the checks after an installation in the order this lesson gives them.

    Give each item its position, from 1 (first).

    Show the answer to question 3

    Answer:

    1. Open a new terminal window
    2. Ask for the version with python3 --version (or py --version)
    3. See which interpreter runs, with sys.executable or which -a python3
    4. Run check_version.py

    A new terminal picks up the new commands. The version and the interpreter's path tell you whether the right Python runs; check_version.py then checks the minimum version in code.

  4. Question 4 of 5 What does this print?

    Read the code, then choose one answer.

    print((3, 9, 1) >= (3, 14))
    Show the answer to question 4

    Answer: False

    Tuples compare item by item, as numbers: the first items are equal (3), and then 9 is less than 14, so 3.9.1 is older than 3.14. Compared as text, "3.9" would sort after "3.14", which is why the lesson compares sys.version_info with a tuple.

  5. Question 5 of 5 From which Python version does the release team no longer publish PGP signatures (PEP 761)?

    Type a number.

    Show the answer to question 5

    Answer: 3.14

    Since Python 3.14, release files are signed with Sigstore only; PEP 761 stopped the PGP signatures.

References

Related tools

Report a problem with this lesson

Quick answers and tool search

Type to search tools or to get a quick answer, for example 18% of 2500. Use the up and down arrow keys to move through the results, Enter to choose, and Escape to close.