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
| Where | Command | What you see |
|---|---|---|
| Windows (PowerShell or CMD) | python --version | Python 3.15.2 |
| Windows, every version | py list | The versions installed with the Python install manager |
| macOS and Linux | python3 --version | Python 3.15.2 |
| Inside Python | import sys; print(sys.version) | 3.15.2 (main, ...) |
| pip | pip --version | pip's version and the Python it belongs to |
| uv | uv python list | The 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:
python --versionTo 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:
python3 --versionmacOS 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:
which -a python3If 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:
python3 --versionMany distributions, such as Ubuntu, only include python3. To see the versioned commands installed on your system:
ls /usr/bin/python3*Check the Python version from a script
Your code can read the version of the Python that runs it:
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 filesys.version_info is the one to use in conditions, because you can compare it with a tuple:
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,pythonis always the version you created it with. - pyenv:
pyenv versionshows the active version andpyenv versionslists them all.
