Skip to content

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:

Find the version of Python that you have installed by python --version command

python
python --version

or

Find the version of Python that you have installed by python -V command

python
python -V

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

Find the version of Python that you have installed, inside a Python script

python
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.

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

Find the version of Python that you have installed, inside a Python script by the platform module

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.

Dual-run preview — compare with live Symfony routes.