Modules and Packages
sys.modules: a dict of currently-loaded/imported modules (the module name (string) –> the module object).
sys.modules['re'] #=> <module 're' from '/usr/lib/python3.4/re.py'>
Q: how can I see from which file a module was loaded? (possibly to look at its source, see its version num, etc.)
1 Using your own local modules
For modules you’ve dropped into ~/pylib:
import sys sys.path.insert(0, '/home/john/pylib')
2 Installing modules
For system-wide modules: use
For your own venvs, use pip.
Use distutils. Maybe use setuptools, if you need it.
Use wheels and twine, if you need it.
Legacy: eggs, easy_install