How to check version of Python
How to check version of python
The versions of Python come with different kinds of features and functionalities. It is not a herculean task to keep track of the updates these days. Just some simple pre-requisites and you are on the path of consistent learning in Python. Python is compatible on all platforms and we can execute its programs on different operating systems. Here we will be looking at some ways & means and how they provide us a medium to check the version of Python installed on our PCs.
So, let’s get started….
It works on the concept of semantic versioning (MAJOR.MINOR. MICRO). Let’s have a look at what do they indicate-
Major – Major versions are the ones in which incompatible API changes are done.
Minor – Minor versions are the ones in which any functionality is added.
Micro – Micro versions are the ones in which bug fixes and updates related to improvements are done.
For instance, the version of Python installed in my system is Python 3.7.3
Here,
- 3 is the major version.
- 7 is the minor version.
- 3 is the micro version.
As we discussed earlier, python can work smoothly on different operating systems. So, let's have a glance at how we can check the versions of python on-
- Windows
- Linux
- MacOS
- Using Scripting
How to check the version of Python in Windows?
There are two ways to check the version of Python in Windows-
- Using Powershell
- Using Command Prompt
Using Powershell

- Click ‘Win+R’ or type ‘Run’ on the taskbar’s search pane.
- Type ‘Powershell’
- A window will appear on your screen named ‘Windows Powershell’
- Click on ‘Enter’
- Type python –version and click on ‘Enter’
- The version would be displayed in the next line.
Using Command Prompt

Type 'Command Prompt' on the taskbar's search pane and you'll see its icon. Click on it to open the command prompt.
Also, you can directly click on its icon if it is pinned on the taskbar.
- Once the ‘Command Prompt’ screen is visible on your screen.
- Type python –version and click on ‘Enter’.
- The version installed in your system would be displayed in the next line.
How to check the version of Python in Linux?
Linux is a free and open-source operating system. The users have access and authority to run, modify & distribute the source code. The command line present in Linux is the medium through which we can interact with our system. It consists of a kernel, system user space, and applications.
In Linux, we have a shell where we type our commands that are interpreted and tells the operating system about what the user wants.
The steps to check the version of Python in Linux is-
- Start your system and switch on to the Linux operating system (you might find it with the name Ubuntu).
- Once the desktop screen of Linux appears, click on ‘Terminal’ to open it.
- In the terminal window, type python –version and click on ‘Enter’.
- In the next line, it will display the current version of python installed in your system.
How to check the version of Python in MacOS?
MacOS is a popular operating system developed by Apple Inc. Its dynamic features and latest updates have made it prevalent among professionals and students.
The steps to check the version of Python in MacOS are-
- Open ‘Terminal’ in MacOS.
- Type python –version
- It will display the current version of python installed in your system.
How to check the version of Python using scripting?
We can check the version of python also by using scripting. The piece of code given below will help you to know the version you are currently working on. Let’s understand the variables that are used here-
- sys.version_info.major
- sys.version_info_minor
Both of them are a part of the tuple that returns the version number. In general, sys.version_info has five components namely major, minor, micro, release levels, and serial
We can execute the given code-
import sys print(sys.version) print(sys.version_info) #it will display the value of five components print(sys.version_info.major) print(sys.version_info.minor)
So, these were the four different approaches we discussed to check the version of Python.
Now we have a clear idea of how to proceed with the checking process on Windows, Linux, MacOS, and through scripting.