4Geeks chosen to deliver AI education in the Bahamas alongside Harvard, Oxford, and Columbia.See more

How to check python version?

By 4Geeks

Find out which Python you have, which one runs in your terminal and your editor, and which one your project needs.

7 min readLast updated
Check Python version icon

How do I check my Python version?

Short answer: Open a terminal and run python --version, or python3 --version on macOS and Linux. The answer looks like Python 3.15.2. On Windows, py list shows every version you have installed. Inside a script, import sys and print(sys.version) tell you which version is running your code. The latest release is Python 3.15.2, from October 25, 2026: if yours is older, see how to update Python.

You can have several versions of Python installed at the same time, so the useful question is not only which version you have, but which one runs when you type python, which one your editor uses and which one your project needs. This guide answers the three.

On Windows, python --version answers directly. On macOS, plain python does not exist, so you use python3. From Python, sys.version_info gives the version as numbers you can compare.

Check your Python version at a glance

WhereCommandWhat you see
Windows (PowerShell or CMD)python --versionPython 3.15.2
Windows, every versionpy listThe versions installed with the Python install manager
macOS and Linuxpython3 --versionPython 3.15.2
Inside Pythonimport sys; print(sys.version)3.15.2 (main, ...)
pippip --versionpip's version and the Python it belongs to
uvuv python listThe versions uv finds on your computer and the ones it can download

python -V with a capital V does the same as python --version. python -VV adds build details, such as the compiler and the date.

Check the Python version on Windows

Open PowerShell, Windows Terminal or CMD from the Start menu and run:

powershell
python --version

To see every version installed:

  • With the Python install manager, the tool that python.org recommends today, run py list.
  • With the older Python launcher that came with the python.org installer, run py -0.

To run a specific version, use py -V:3.14 --version with the install manager.

To find out which file runs when you type python, use where.exe python in PowerShell, or where python in CMD. In PowerShell, plain where is a shortcut for another command and prints nothing.

If you get Python was not found; run without arguments to install from the Microsoft Store, Windows is running its own shortcut instead of Python. Install Python first, or turn off the two App Installer entries for python.exe and python3.exe in Settings > Apps > Advanced app settings > App execution aliases.

Check the Python version on macOS

Open the Terminal app (press Cmd + Space and type Terminal) and run:

bash
python3 --version

macOS no longer includes a python command, so python --version answers command not found: python. That does not mean Python is missing: use python3.

To see every python3 on your PATH, and which one comes first:

bash
which -a python3

If you installed a specific version with Homebrew, call it by its full name, for example python3.15 --version.

Check the Python version on Linux

Open a terminal and run:

bash
python3 --version

Many distributions, such as Ubuntu, only include python3. To see the versioned commands installed on your system:

bash
ls /usr/bin/python3*

Check the Python version from a script

Your code can read the version of the Python that runs it:

python
import sys
print(sys.version)           # 3.15.2 (main, ...) as text
print(sys.version_info[:3])  # (3, 15, 2) as numbers
print(sys.executable)        # the path of the Python running this file

sys.version_info is the one to use in conditions, because you can compare it with a tuple:

python
import sys
 
if sys.version_info < (3, 10):
    sys.exit("This program needs Python 3.10 or newer")

platform.python_version() also returns the version as text, such as '3.15.2'.

Check the version in VS Code, Jupyter and virtual environments

  • VS Code: the version of the selected interpreter appears in the status bar when you open a Python file. To change it, open the Command Palette and run Python: Select Interpreter.
  • Jupyter Notebook: run import sys; print(sys.version) in a cell. It shows the kernel's Python, which can be different from the one in your terminal.
  • Virtual environment: activate it and run python --version. Inside it, python is always the version you created it with.
  • pyenv: pyenv version shows the active version and pyenv versions lists them all.
Career · AI Engineering

You know your Python version, now build something with it

From zero to junior AI Engineer: Python, AI agents and RAG with mentors and real projects.

Check your Python version with AI

An AI assistant such as ChatGPT, Claude or GitHub Copilot is useful when the version you see is not the one you expected. These three prompts are ready to copy.

1. Understand which Python you are using

I'm on [Windows 11 / macOS 15 / Ubuntu 24.04].
python --version shows [Python 3.12.4] and python3 --version shows [Python 3.15.2].
This is the output of [where.exe python / which -a python3]:
[paste the output]
Explain which Python runs with each command and which one I should use for a new project.

2. Check if your version works with a project

My Python version is [3.15.2]. This is my project's requirements.txt or pyproject.toml:
[paste it]
Tell me if any package or setting needs a different Python version,
and what to change if it does.

3. Make your script check the version

Write a short Python check for the start of my script that stops with a clear message
if the Python version is older than [3.11], and explain why it uses sys.version_info.

Check the answer against the output of python --version on your own computer before you change anything.

What the version number means

A Python version has three numbers, for example 3.15.2:

PartExampleWhat it means
Major3The language generation. Python 2 reached its end of life in 2020, so you should always be on 3
Minor15A version with new features, released once a year. Each one installs separately, with its own packages
Micro2Bug and security fixes for that minor version. Install them whenever they come out

Python 3.15 is the newest minor version, and 3.14 and 3.13 still receive fixes. If your terminal shows Python 2.7, you are running an old system Python: use python3, or install a current version.

Learn with a mentor

Know your tools like a pro, then build AI with Python

In the 4Geeks AI Engineering career program you start with no experience and finish with AI agents and RAG systems in your portfolio.

Common errors when you check your Python version

What you seeWhy it happensFix
command not found: pythonmacOS and many Linux systems only have python3Run python3 --version
'python' is not recognized as an internal or external commandPython is not installed, or it is not in the PATHInstall Python with the Python install manager, or run the installer again with Add python.exe to PATH checked, and open a new terminal
Python was not found; run without arguments to install from the Microsoft StoreWindows runs its own shortcut instead of PythonInstall Python, or turn off the App Installer aliases in App execution aliases
python --version and pip --version show different versionspip belongs to another PythonUse python -m pip, so pip always matches the Python you run
VS Code shows a different version than the terminalThe editor uses another interpreterRun Python: Select Interpreter and choose the one you want
You updated Python but still see the old versionThe old one comes first in the PATH, or the terminal was already openOpen a new terminal and see how to update Python in the terminal
Free download

Every way to check your Python version in a 2-page cheat sheet

The commands for Windows, macOS and Linux, how to read the version from your code, VS Code, Jupyter and virtual environments, the most common errors and prompts for ChatGPT, Claude or Copilot. Free, in PDF.

Check Python version cheat sheet: Windows, macOS, Linux and code

2 pages · PDF · 4Geeks

  • The commands for PowerShell, CMD, the macOS Terminal and Linux
  • How to read and require a version from your code
  • The 5 most common errors and prompts to fix them with AI

Get it free

Your PDF right away

Frequently asked questions about checking your Python version

Want to go from checking Python to building AI agents, with real projects and mentors?

See the AI Engineering program