How To Check Python Version?
Python is dynamic scriptin language which provides rich features. Python have two main version named Python version 2 and version 3. We can call them simply Python2 or Python3 . In this tutorial we will learn how yo check Python version or a script version.
Default Python Version
Every Python installation have a default version even there is two version of Python. If we can
python command and enter to the check version.
We can see from first line which is like
Python 2.7.15rc1 which is simply Python2. We also get the
gcc version which compiled this Python binary.
Another function to check python version is
python_version() function. But first we need to import platform module like below.
We can also use
version variable which is provided by
Python –version Option
Every Python interpreter supports the
--version option in the command like below bash. We can call this option like below in order to learn default Python version.
$ python --version
OR to learn Python3 subversion
$ python3 --version
OR to learn Python2 subversion
$ python2 --version
Listing Python Interpreters
As Python 2 and 3 version there are different interpreters which provides Python programming language features. We can list these interpreters as files like below. We will use following
$ ls /usr/bin/python*