Installing Python

Beginner20 min

Install Python 3.15, confirm it runs from a terminal, and choose between the python.org installer and uv.

What you will learn
  • Install Python 3.15 on your computer
  • Check which version a terminal command runs
  • Choose between the python.org installer and uv
On this page

You cannot run a Python program until a Python interpreter is on your machine, and many computers already have an old one that you should leave alone. This lesson gets a current interpreter installed and proves it works.

Which version to install

This course uses Python 3.15, released on 9 October 2026. Everything you meet here runs on 3.15. When a feature needs a newer release than 3.11, the lesson says so with a marker such as Requires version 3.13 or later, so learners on an older install can tell what will and will not work.

If you already have 3.11, 3.12, 3.13 or 3.14, you can follow most lessons without installing anything. Python 3.10 reached end of life on 1 October 2026 and no longer receives security fixes, so upgrade if that is what you have.

Install it

Windows

On Windows, install the Python install manager. Get it from the Microsoft Store app (click Install), or download it from python.org/downloads and double-click the file. The two versions are identical. It gives you the python, py and pymanager commands.

The manager installs Python versions for you. Open a terminal and ask for 3.15:

Terminal window
py install 3.15
py -V:3.15 --version

py -V:3.15 selects that version, which matters once you have several. Plain python starts the default one, the latest stable release unless you configure otherwise. The first time you install a version you may be offered a directory to add to your PATH. That is optional if you use py.

The older full installer (with its “Add python.exe to PATH” box) and the standalone py launcher are deprecated since 3.14, and no full installer will be built for 3.16 or later. Use them only if you cannot install the manager.

macOS

Download the macOS installer from python.org/downloads and open the package. The command is python3, not python.

Terminal window
python3 --version

Linux

Most distributions ship Python 3 already, but often not the newest release. Check what you have first. If it is older than you want, install 3.15 from your package manager when it is available there, or use uv as described below. Avoid replacing the system Python: parts of your operating system depend on it.

Terminal window
python3 --version

Check that it worked

Open a new terminal window (a window opened before the install may not see the change) and ask for the version.

Terminal window
python3 --version

You should see Python 3.15.0 or a later 3.15 release. Which command name works depends on your system:

  • python3 works on macOS and Linux.
  • python and py work on Windows once the install manager is installed.
  • python works on some systems, inside a virtual environment for example. On others it is missing or points at a different version.

If the command is not found, the usual cause is that Python is installed but its folder is not on your PATH, the list of folders your terminal searches for programs. On Windows, try py first, which does not depend on PATH, and remove or fix older Python entries on your PATH that might shadow it. Elsewhere, open a fresh terminal first.

An alternative: uv

uv is a fast tool for installing Python versions and managing projects. It can fetch an interpreter without touching your system, which is handy on Linux.

Terminal window
uv python install 3.15
uv run --python 3.15 python --version

The python.org installer is the simplest start for a beginner. Reach for uv when you need several Python versions side by side. A later module covers it in full.

Look inside your interpreter

A program can ask Python which version is running. You will not need to save a file for this. Start the interpreter with python3 (or py on Windows), type the two lines below, and press Enter after each. The next lesson explains the >>> prompt properly.

The first line, import sys, makes Python’s built-in sys module available. A module is a bundle of ready-made tools, and a later lesson explains import fully. Here you only need to know that sys.version_info is one of the tools inside it.

check_version.py
import sys
print(sys.version_info)
Output
sys.version_info(major=3, minor=15, micro=0, releaselevel='final', serial=0)

On a later 3.15 release, the micro number will be higher. Each part has a name, and a dot after sys.version_info picks one out:

version_parts.py
import sys
print(sys.version_info.major, sys.version_info.minor)
Output
3 15

print writes its values to the screen with a space between them. You will learn more about it in lesson 3.

Common pitfalls

  • Two Pythons, one command. A computer can have several. python3 --version tells you which one that command name reaches. Always check before you wonder why a feature is missing.
  • An old Python shadowing the new one on Windows. If python runs the wrong version, use py -V:3.15, and clean up old PATH entries.
  • Changing the system Python on Linux or macOS. Install a separate one instead.
ExerciseInstall 3.15 and print its version

Install Python 3.15, start the interpreter, and print only the major and minor numbers from sys.version_info, separated by a space.

Input: none. Expected output on 3.15: 3 15.

Show solution
version_info.py
import sys
print(sys.version_info.major, sys.version_info.minor)
Output
3 15

The fields of sys.version_info can be read by name, so no slicing is needed.

ExerciseRelease level and patch number

Print the micro and releaselevel fields of sys.version_info on one line. Input: none. Expected output on a stable 3.15.0 install: 0 final. On a later patch release the first number is higher. A pre-release build would print something like alpha or rc instead of final.

Show solution
release_level.py
import sys
print(sys.version_info.micro, sys.version_info.releaselevel)
Output
0 final

micro counts bug-fix releases within 3.15, and releaselevel tells you whether you are running a finished release.

Summary

  • Install Python 3.15 from python.org, or use uv, and keep the system Python as it is.
  • Check the version with python3 --version, or py --version on Windows.
  • import sys followed by print(sys.version_info) shows which interpreter is running.

Next: the interactive prompt and running a saved file.