Config Server Firewall

How to Check Python Version in Windows

We can check the Python version installed on Windows 10 by opening up a Command Prompt and typing the following command:

python -V
windows check python version

If you want to check the Python version inside the Python interpreter, you can do this by importing the sys module. Open the command prompt (or PowerShell) and type python to open the interpreter.

Then, after starting the Python shell, import the sys module and then run the print(sys.version_info) command.

import sys

If the command print your Python version has the major=3 attribute, it means that you are running a Python 3 on your Windows 10 computer.

how to check python version in windows script

Just to print the major version, execute the following command:


You can also use the sys module to check the Python version in a script like this:

import sys

python_version = sys.version.split()[0]

The preceding script will print the version number of the Python that runs its code. This script uses the split() method of the sys.version module to get the Python’s version number.

check python version windows