Different ways to Check the Python Version

Python is a programming language that is evolving every day. Many times, you will have to print the version number of the Python that is installed on your system.

If you want to determine the version of python installed on your system or you want to print the version of the current python installation in your script, read along.

Are you new to Python? If you are wondering how to install Python on your Windows system, check out this guide.

Understanding Versioning in Python

Python versions are in the form of major_version.minor_version.micro_version

  • Bug fixes and simple cosmetic fixes are added in micro_versions.
  • Functions and features are added in minor versions.
  • The largest changes are made and added to major_versions. 

Python has two major versions – Python 2 and Python 3. Python 3 is the latest release and is used extensively.

Consider the latest release, 3.10.1. The major, minor and micro versions are as follows:


Method 1: Checking the Version from the Python Interpreter.

Open your Python interpreter to check the version of python installed in your system.



Method 2: Checking the Python Version from Command-Line.

1. Open your Command-Line.

For Windows users, it is Command Prompt. For Mac/Linux users, it is the Terminal window.

python --version


Python 3.10.1


python  -V


Python 3.10.1


python -VV


Python 3.10.1 (tags/v3.10.1:2cd268a, Dec 6 2021, 19:10:37) [MSC v.1929 64 bit (AMD64)]

If you want to check for Python 3 specifically, use python3 instead of python in the above commands. As an example, look at the below command.

python3 --version

Method 3: Check the Python Version from the sys module

Python has a built-in library named sys that can be used to determine the version of the current installation of Python.

Using sys.version:

If you want just the version number, then use this option.

import sys
print("Python Version : ",sys.version)

Output :


Python Version :  3.10.1 (tags/v3.10.1:2cd286a, Dec  6 2021, 19:10:37) [MSC v.1929 64 bit (AMD64)]

Using sys.version_info:

If you need some more details like the release level, serial etc. use the sys.version_info


import sys

print("Python Version(Detailed) : ",sys.version_info)

Output :

Python Version(Detailed) :  sys.version_info(major=3, minor=10, micro=1, releaselevel='final', serial=0)


If you want to extract the value of the major version, minor version, and micro version separately, extract them as follows-

import sys

print("Major Version : ",sys.version_info.major)
print("Minor Version : ",sys.version_info.minor)
print("Micro Version : ",sys.version_info.micro)

Output :

Major Version :  3
Minor Version :  10
Micro Version :  1


Method 4: Printing the Python Version using the platform module.

Python has another built-in library named platform that can be used to check the version of Python.


import platform

print("Python Version: ", platform.python_version())

Output :


Python Version:  3.10.1

If you want the version in the form of a tuple, check the below snippet.


import platform

print("Python Version: ", platform.python_version_tuple())

Output :


Python Version:  ('3', '10', '1')



In this article, we have discussed different ways to determine the Python version. I hope this helps.

If you found this article useful, kindly comment and let us know.

If you enjoyed reading, share this article.

Anusha Pai is a Software Engineer having a long experience in the IT industry and having a passion to write. She has a keen interest in writing Python Errorfixes, Solutions, and Tutorials.

4 thoughts on “Different ways to Check the Python Version”

Leave a Comment