Month: June 2016

Finding Python & Modules version

This is how you can find python and installed modules version.

#import the sys module which contains the version function.

>>> import sys
>>> print ‘Installed Python version is :’, sys.version

Installed Python version is : 2.4.3 (#1, Oct 23 2012, 22:02:41)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-54)]

For other modules we can use the __version__ function. To find the version of csv module,

>>> import csv
>>> print ‘CSV module version is’, csv.__version__

1.0

This method may not work for all modules, but in my experience it works for most of the modules.