使用PHP,您可以使用phpinfo()
函数列出已安装的模块,并从中查找它们的功能。
是否有一种方法可以查看已安装的软件包/模块以进行导入?
help()
,然后...To get a list of available modules, keywords, or topics, type "modules",
"keywords", or "topics". Each module also comes with a one-line summary
of what it does; to list the modules whose summaries contain a given word
such as "spam", type "modules spam".
help> modules
ipython
,则可以键入import
(注意末尾的空格),然后按[TAB]
键获取可导入模块列表。ipython
,并且尚未尝试过它,那么值得一看。它比基本的Python shell或我使用过的任何其他REPL都要好得多。
ipython
安装ipython
软件包,您可以通过系统管理工具进行安装。其他人需要遵循这些说明。easy_install
,你可能想考虑改用pip
。 pip
比easy_install
更智能,能更好地跟踪文件位置。 如果你最终想要卸载ipython
,这将非常有帮助。from
+[TAB]
。 关于包和模块之间的区别的解释可在Python官方教程的模块章节中找到。easy_install
的这个缺点,并试探性地建议使用pip
。我发现在轻度使用时,它确实像广告中所说的那样跟踪已安装的脚本等,尽管我尚未尝试使用它卸载像ipython这样复杂的任何东西。 - intuitedhelp("modules")
还会列出除了已安装的包之外的所有包。 - Mafhelp("modules")
还会列出除了已安装的包之外的所有包。 - undefined这非常有用。这是这个的脚本版本:
# To list all installed packages just execfile THIS file
# execfile('list_all_pkgs.py')
for dist in __import__('pkg_resources').working_set:
print dist.project_name.replace('Python', '')
您可以这样列出可用的模块:
python -c "for dist in __import__('pkg_resources').working_set:print dist.project_name.replace('Python', '')"
ImportError('No module named pkg_resources',)
的错误。 - n611x007math
。 - Martin Thomafrom pip._internal.operations.freeze import freeze
for line in freeze():
print(line.split('=='))
pydoc
工具中的pydoc modules
命令来在解释器内或者解释器外查看模块文档。 - Thomas Woutershelp('modules')
和help('modules keyword')
来搜索关键字。 - Bruno Alexandro García Tejadahelp("modules")
。这对脚本非常有用。 - Mafhelp("modules")
。这对脚本非常有用。 - undefined