Python updates often, and projects frequently pin a specific release. Knowing which one you run helps you catch compatibility bugs and security gaps before they surface. This guide shows fast ways to check Python version through the terminal, a short script, package managers, Docker, editors, and virtual environments, plus what to do when the number turns out wrong.

Why you should check the Python version

Each release ships different syntax, standard library modules, and support timelines. Running the expected one keeps builds compatible and makes odd behaviour easier to trace.

Many libraries set a minimum version, so the wrong interpreter breaks installs outright. Newer code calls features that older builds lack, and legacy code sometimes fails on a newer release. Outdated versions can also carry unpatched security flaws, and a quick check shows which machines need attention.

Python stays widely used for this reason. A Statista survey recorded 51% of developers working with it, ranking it the third most used language worldwide.

51% developers use Python (Statista)

How to check Python version from the command line

Open Command Prompt on Windows, Terminal on macOS, or press Ctrl+Alt+T on Linux. Then run one of these:

python --version
python -V

If that returns an error or nothing, the interpreter is likely registered as python3:

python3 --version

The terminal prints the release, such as Python 3.12.4. Most Linux and macOS setups expect python3 by default. For more terminal basics, see the guide to running Python scripts on Linux.

Check Python version with a short script

The sys module reports the same details from inside your code, which helps when a script needs to confirm its own runtime.

import sys
print(sys.version)
print(sys.version_info)

The output gives the full number, build date, and compiler, like 3.10.12 (Jul 8 2023) [MSC v.1929 64 bit (AMD64)]. The python man page lists every interpreter flag if you want the full reference.

Check Python version using package managers

Package managers report the build they installed. Commands differ by system:

SystemCommand
Windowswinget, or Apps & Features in Settings
Debian / Ubuntuapt show python3
Red Hat / CentOSyum info python3
macOS (Homebrew)brew info python

The 2.x line reached end of life in 2020, though python2 still ships on some legacy machines.

Check Python version inside Docker

For a container that is already running, use:

docker exec <name-or-id> python --version

To test an image without keeping a container around:

docker run --rm <image-name> python --version

The second command starts a fresh container, prints the number, then removes itself.

Check Python version in your editor

In PyCharm, open the built-in terminal and run python –version. In VS Code, read the interpreter shown at the bottom left, or run the same command. In Jupyter Notebook, run import sys, then print(sys.version).

Check Python version in virtual environments

A virtual environment keeps each project’s interpreter and packages separate, so two projects can run different releases without clashing. Activate the environment first, then check the number:

ToolActivation
venv / virtualenv (Mac/Linux)source <folder>/bin/activate
venv / virtualenv (Windows)<folder>\Scripts\activate
condaconda activate myenv

Run python –version once the prompt shows the environment name.

Fix common Python version problems

Several builds present: point the script at the correct path, or use a version manager to switch between them.

Command not found: Python is missing or absent from the PATH, most often on Windows. Install it and add it to the PATH. Automation that mixes Python with shell scripts depends on a consistent PATH across machines.

Old build present: move up to a supported release. Our walkthrough on updating Python covers each platform.

When to upgrade, downgrade, or keep your version

ChoiceWhen it fits
StayThe project runs fine, libraries have not caught up yet, or a legacy app needs a fixed build.
UpgradeSecurity patches ship, new syntax or speed gains arrive, or libraries drop end-of-life builds.
DowngradeA key library lags behind, old projects fail their tests, or a new release introduces bugs.

FAQs

What is the latest Python version?

As of July 2026, Python 3.14.6 is the newest stable build, released on 10 June 2026. Many teams still run 3.13 or 3.12 in production for full library support.

How do I check Python version on Windows?

Open Command Prompt and run python –version. A number confirms the install. A “not recognised” message means Python is missing or absent from your PATH.

How do I see every Python version installed on Windows?

Run where python to list each path, or py -0 with the Python Launcher. On Linux or Mac, run ls /usr/bin/python* and check each binary.

Why does python –version fail on Mac or Linux?

Many systems map python to Python 2 or to nothing at all. Use python3 –version instead, which points to the installed Python 3 interpreter.

What does python -V do?

It prints the installed Python version, the same output as python –version. The capital V is a shorthand flag for the full command.

Image

Willie has over 15 years of experience in Linux system administration and DevOps. After managing infrastructure for startups and enterprises alike, he founded Command Linux to share the practical knowledge he wished he had when starting out. He oversees content strategy and contributes guides on server management, automation, and security.