I remember someone showed me a way but its eluded me so far. I'm trying to get the version number of a specific few modules that I use. Something that I can store in a variable.
+1
A:
I think it depends on the module. For example, Django has a VERSION variable that you can get from django.VERSION, sqlalchemy has a __version__ variable that you can get from sqlalchemy.__version__.
Matthew J Morrison
2010-08-19 16:59:53
django also has `django.get_version()`, which returns a string rather than a tuple. When in doubt, `dir(module)`.
Seth
2010-08-19 17:01:59
Or you can use the `getmembers` function from the [inspect module](http://docs.python.org/library/inspect.html).
ire_and_curses
2010-08-19 17:04:07
+2
A:
Generalized answer from Matt's, do a dir(YOURMODULE) and look for __version__, VERSION, or version. Most modules like __version__ but I think numpy uses version.version
Nick T
2010-08-19 17:03:27
Just to note that `__version__` is the preferred standard for new code, as recommended by [PEP8](http://www.python.org/dev/peps/pep-0008/). See [Standard way to embed version into Python package?](http://stackoverflow.com/questions/458550/standard-way-to-embed-version-into-python-package)
ire_and_curses
2010-08-19 17:07:51