Flash Sale:75% Off Hosting + Free DomainEnds in13h47m14sView Plans
Hostvento logoHostvento

Check the Python Version on Linux and Windows

One command shows which Python version is installed.

How-To Guides1 min read5 screenshots

Why check

  • Libraries and frameworks need certain Python versions.
  • Syntax changes between versions. For example Python 2 used print "x" and Python 3 uses print("x").
  • Old features get removed. The version tells you what is safe to use.

On Linux

With the command line

python3 --version
python3 --version

The short form gives the same result:

python3 -V
python3 -V

If you see "command not found", Python is not installed. Install it with your package manager.

With the interpreter

python3

Then type:

import sys
print(sys.version)
The version inside the Python interpreter

This prints the full version with build details. Leave the interpreter with exit().

On Windows

With Command Prompt

Open cmd.exe and run:

python --version
python --version in Command Prompt

If it does not work, try py --version.

With the interpreter

python

Then type:

import sys
print(sys.version)
The version inside the Python interpreter

Quick recap

  • python3 --version on Linux, python --version on Windows.
  • sys.version shows the full detail.