List all installed python modules (or determine bad module versions)

Alec Jacobson

March 11, 2010

weblog/

Here's a simple python script to list all installed python modules:
python -c "help('modules')"
Only problem is that when I run this I see:

Please wait a moment while I gather a list of all available modules...

Fatal Python error: Interpreter not initialized (version mismatch?)
Abort trap
This error message is not helpful because it does not tell me which Python module caused the error. So, to determine which module is actually compiled with the wrong python version I run this command with the verbose flag instead:
python -vc "help('modules')"