Using help and pydoc to list python modules not working

China☆狼群 提交于 2019-12-23 19:43:48

问题


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.



来源:https://stackoverflow.com/questions/12063718/using-help-and-pydoc-to-list-python-modules-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!