I would like to get a list of Python modules, which are in my Python installation (UNIX server).
How can you get a list of Python modules installed in your computer?
There are many ideas, initially I am pondering on these two:
pip
cons: not always installed
help('modules')
cons: output to console; with broken modules (see ubuntu...) can segfault
I need an easy approach, using basic libraries and compatible with old python 2.x
And I see the light: listmodules.py
Hidden in the documentation source directory in 2.5 is a small script that lists all available modules for a Python installation.
Pros:
uses only imp, sys, os, re, time
designed to run on Python 1.5.2 and newer
the source code is really compact, so you can easy tinkering with it, for example to pass an exception list of buggy modules (don't try to import them)