How to check the version of Python on your system in several ways

Published on Aug. 22, 2023, 12:15 p.m.

You can check the version of Python on your system in several ways. Here are a few methods:

  1. Using the command line: Open your command prompt or terminal and type python --version. This will output the current version of Python that is installed on your system.
  2. Using the platform module: You can import the platform module in Python and use its python_version() function to retrieve the Python version on your system. Here’s an example:
import platform
print(platform.python_version())
  1. In Python console, you can also use the sys module to obtain the version information about your Python installation, like this:
import sys
print(sys.version)

Whichever method you choose, you should get a string that contains the version of Python that is currently installed.

Tags:

related content