Installed modules list?

John J. Lee phrxy at csv.warwick.ac.uk
Tue Apr 17 12:36:51 EDT 2001


On Tue, 17 Apr 2001, Steve Purcell wrote:

> Carsten Gaebler wrote:
> > Is there a simple way of generating a list of all installed modules or do
> > I have to walk through all directories in sys.path?
>
> Option 2.
>
> (You can get the list of builtin modules using sys.builtin_module_names, but
> that's only part of the story, of course)

I was going to suggest a find command, if you're on unix, but then I
discovered I didn't understand python syntax:

$ echo `python -c 'for d in [1,2]: print d'`

works, while

$ echo `python -c 'import sys; for d in [1,2]: print d'`

doesn't -- it's a SyntaxError.

Why?


John




More information about the Python-list mailing list