Which version of Python do I have installed?

You can find the version of Python that you have installed by running the following command in your command prompt or terminal:

python --version

or

python -V

You can also find the version of Python by running the following command in a Python script or the Python interactive shell:

import sys
print(sys.version)

This will return a string that contains the version of Python you have installed, along with other information such as the version of the build and the platform it was built on.

Watch a course Python - The Practical Guide

You can also use the platform module to get the version of python

import platform
print(platform.python_version())

This will only return the version of python in string format i.e '3.8.6'

It's also worth noting that if you have multiple versions of Python installed on your system, the command prompt or terminal command may show the version of the default Python interpreter. You can specify a specific version of Python by running the command as python3 --version or python3.8 --version for example, instead of just python.