thefourtheye's weblog

opinions are my own; try code/suggestions at your own risk

Check Python Package Version in Program

| Comments

I have always wanted to check the version of the python packages which I am using. Today I found a way to find that.

As stated here,

http://stackoverflow.com/questions/710609/checking-python-module-version-at-runtime

>>> pkg_resources.get_distribution('web.py')
web.py 0.37 (/usr/local/lib/python2.7/dist-packages/web.py-0.37-py2.7.egg)

To get just the version, you can do


>>> pkg_resources.get_distribution('web.py').version
'0.37'