Which package is Python using?

The __file__ attribute will tell you:

>>> from unittest import signals
>>> signals.__file__
'/usr/lib/python2.7/unittest/signals.pyc'

.pyc are compiled files, so the file you actually are looking for in this case it the /usr/lib/python2.7/unittest/signals.py file.


I hope I understood correctly, but here's how you find out the location of the module you loaded:

shell> python -c 'import jinja2; print jinja2.__file__'
/Library/Python/2.7/site-packages/jinja2/__init__.pyc

Tags:

Python

Package