The quickest way to check the Python version is to run this command in the command line:
1 |
python --version |
Another, and quicker way (note the capital v):
1 |
python -V |
Both commands will work on all popular systems: Windows, Linux, and Mac.

More information
You can add another capital v, if you want more information, like the Python version, and release date.
It will also display whether you use the 32-bit or 64-bit versions.
1 |
python -VV |

Python versions
There are two major Python versions: Python 2 and Python 3 that are not fully compatible.
If both versions are installed on the machine you can check for Python 2 using this command:
1 |
python --version |
or
1 |
python2 --version |
If you want to check the python3 version, use this command:
1 |
python3 --version |
Check the Python version inside the code
To check the version of the Python interpreter inside the script you have to import the sys module first, and then display the Python version.
1 2 |
import sys print(sys.version) |
The print function will display this result:
3.7.2 (tags/v3.7.2:9a3ffc0492, Dec 23 2018, 23:09:28) [MSC v.1916 64 bit (AMD64)]
You can also display the system version info:
1 |
print(sys.version_info) |
Result:
sys.version_info(major=3, minor=7, micro=2, releaselevel='final', serial=0)