How To Find Python Version?

RSS
FACEBOOK
FACEBOOK
PINTEREST
PINTEREST
LINKEDIN
INSTAGRAM

I want to run some python scripts but want to learn version of the python installed on the system. How can I do that? This works almost all operating systems from Windows to Linux, from Mac OS to Bsd.

Get Version Of Default Python Interpreter

We can get default python interpreter version like below. As we know that if the version of python is not specified the default python interpreter will be called.

OR

Get Version Of Default Python Interpreter
Get Version Of Default Python Interpreter

We can see from output that current or default Python interpreter version is 2.7

Get Python2 Exact Version

We can get Python2 exact version like below

Get Python3 Exact Version

We can get Python2 exact version like below

Get Python3 Exact Version
Get Python3 Exact Version

Using sys.version Information

Python provides version attribute in sys module. We can use this attribute in order to get Python version interactively or programatically.

Using sys.version Information
Using sys.version Information

Update Python Interpreter Version

If we want to update Python interpreter we generally use package managers provided by the distributions.

Ubuntu, Debian, Mint, Kali

Fedora, CentOS, RedHat

OR

RSS
FACEBOOK
FACEBOOK
PINTEREST
PINTEREST
LINKEDIN
INSTAGRAM
LEARN MORE  How To Loop and Iterate Over Python Dictionary?