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.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s