I would like to have this info during run-time or in ipython. For example,
import matplotlib
How do I know which matplotlib.py is used if I have multiple versions or I just want to know where the file located.
Thanks
I would like to have this info during run-time or in ipython. For example,
import matplotlib
How do I know which matplotlib.py is used if I have multiple versions or I just want to know where the file located.
Thanks
Inspect the module's __file__
attribute.
In [1]: import matplotlib
In [2]: matplotlib.__file__
Out[2]: '/usr/lib/pymodules/python2.7/matplotlib/__init__.pyc'
(Works in vanilla Python too.)
You can use the sys.modules
to find the path of it.
Such as:
import math
import sys
print sys.modules['math']