Print version of a module without importing the entire package

Viewed 1893

Is it possible to check the version of a package if only a module is imported?

When a package is imported like...

import pandas as pd

I use:

print('pandas : version {}'.format(pd.__version__))

to print the version number.

How do I check the version number if only a module is imported, like

import matplotlib.pyplot as plt

or

from sklearn.metrics import confusion_matrix

Any suggestions?

1 Answers
Related