I am using pyodbc
and I want to know the version of it that I am using.
Apparently I cannot use pyodbc.__version__
because probably the variable is not set.
How else can I figure out the version of the package?
I am using pyodbc
and I want to know the version of it that I am using.
Apparently I cannot use pyodbc.__version__
because probably the variable is not set.
How else can I figure out the version of the package?
You can use this command (from terminal)
For installation of pip (debian, ubuntu):
To get a short report about the module, including its version, run:
pip show pyodbc
in a command prompt (e.g. Windows
cmd
). This works even for modules without a __version__ attribute.It does have the version info, just use
.version
:The pip show command would also get it for you:
You could redirect stdout and parse the output:
But an easier way is to use
pkg_resources
, if you look at the source for show, you can see how it is gathered:To use it just pass the package name:
You can easily extend it to get different info using similar logic to the show command.