Created
September 8, 2017 22:51
-
-
Save mkolod/a509fbee7157a92626e003d9956d6ef3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Find the location on the pythonpath from which | |
# the package was imported. This helps debug pythonpath | |
# priority-related conflicts. | |
def pkg_loc(module_name): | |
module = __import__(module_name, globals(), locals(), [], -1) | |
return module.__file__ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage:
print(pkg_loc("numpy"))
/home/marek/anaconda2/lib/python2.7/site-packages/numpy/init.pyc