Some Python Examples
← prev | next →     Top-level ToC     /modules-packages.html     (printable version)

sys.modules: a dict of currently-loaded/imported modules (the module name (string) –> the module object).

#=> <module 're' from '/usr/lib/python3.4/'>

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 apt.

For your own venvs, use pip.

3 Packaging

Use distutils. Maybe use setuptools, if you need it.

Use wheels and twine, if you need it.


Legacy: eggs, easy_install