Using help and pydoc to list python modules not wo

2019-07-06 22:59发布

问题:

I'm trying to find out what modules I have installed for python

from: this thread

I've tried

>>> help('modules')
no Python documentation found for 'modules'

>>> pydoc modules
  File "<stdin>", line 1
    pydoc modules
                ^
SyntaxError: invalid syntax

However, this works

>>> help('numpy')

along with any other module I know I have installed.

This does return the modules, but is there a way to fix my help documentation?

from pkgutil import iter_modules
for a in iter_modules():
    print a

Edit

I installed the 64 bit python 2.7 through the enthought python distribution on Mac OS mtn lion

running pydoc in shell:

$ pydoc modules
no Python documentation found for 'modules'

回答1:

help('modules') is deliberately disabled in newer versions of Enthought's Python because it reliably causes segfaults with a standard set of EPD packages.

One way to list all packages you have installed in EPD is with enpkg -l. Note that this tool only lists packages you have installed with the EPD installer or enpkg itself; it won't know about packages you have installed by hand or, for example, with pip.

More info about the enpkg tool can be found by typing enpkg --help, or in this Enthought Knowledge Base Article: https://support.enthought.com/entries/22415022-using-enpkg-to-update-epd-packages



回答2:

You can try, '>>> help()' in python. This will take you to help prompt, that will look something like - help>

Here you can type 'modules' to get list of all modules.