How To Check Python Version?

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/how-to-check-python-version/
PINTEREST
PINTEREST
INSTAGRAM

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.

Default Python Version
Default Python 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.

python_version() Function

Another function to check python version is python_version() function. But first we need to import platform module like below.

python_version() Function
python_version() Function

version Variable

We can also use version variable which is provided by sys module.

version Variable
version Variable

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.

OR to learn Python3 subversion

OR to learn Python2 subversion

--version Option
–version Option

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

Listing Python Interpreters
Listing Python Interpreters

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/how-to-check-python-version/
PINTEREST
PINTEREST
INSTAGRAM
LEARN MORE  What is Microsoft Powershell ? How Can I Automate Tasks?