打印 Python 本机库列表
Print Python native libraries list
如何打印 Python 已有的库。如os
、math
、socket
等
是否有类似于 "pip list" || "pip freeze"
的过程打印我安装的库?
(我是 Python 的新手,如果我对 python 库有严重的误解,请帮助我)。
你可以打印出 help('modules')
:
只显示几行输出,因为它很大
>>> help('modules')
Please wait a moment while I gather a list of all available modules...
IN aifc hmac sf
__future__ another html shelve
_ast antigravity http shlex
_bisect argparse idlelib shutil
_bootlocale array imaplib signal
_bz2 ast imghdr site
_codecs asynchat imp smtpd
_codecs_cn asyncio importlib smtplib
_codecs_hk asyncore inspect sndhdr
_codecs_iso2022 atexit io socket
_codecs_jp audioop ipaddress socketserver
_codecs_kr base64 itertools something
_codecs_tw bdb json sqlite3
_collections binascii keyword sre_compile
_collections_abc binhex lib2to3 sre_constants
_compat_pickle bisect linecache sre_parse
_compression builtins locale ssl
_crypt bz2 logging stat
_csv cProfile lzma statistics
_ctypes calendar macpath string
您也可以通过搜索匹配的词来缩小范围。例如,您想查找可能匹配 "collections":
的内容
>>> help('modules collections')
Here is a list of modules whose name or summary contains 'collections'.
If there are any, enter a module name to get more help.
_collections - High performance data structures.
_collections_abc - Abstract Base Classes (ABCs) for collections, according to PEP 3119.
collections
collections.__main__
collections.abc
test.test_collections - Unit tests for collections.py.
test.test_defaultdict - Unit tests for collections.defaultdict.
pip._vendor.requests.packages.urllib3._collections
然后,如果您需要有关特定模块的帮助,以获取有关它的更多信息,您只需调用该特定模块的帮助:
>>> help('collections')
如何打印 Python 已有的库。如os
、math
、socket
等
是否有类似于 "pip list" || "pip freeze"
的过程打印我安装的库?
(我是 Python 的新手,如果我对 python 库有严重的误解,请帮助我)。
你可以打印出 help('modules')
:
只显示几行输出,因为它很大
>>> help('modules')
Please wait a moment while I gather a list of all available modules...
IN aifc hmac sf
__future__ another html shelve
_ast antigravity http shlex
_bisect argparse idlelib shutil
_bootlocale array imaplib signal
_bz2 ast imghdr site
_codecs asynchat imp smtpd
_codecs_cn asyncio importlib smtplib
_codecs_hk asyncore inspect sndhdr
_codecs_iso2022 atexit io socket
_codecs_jp audioop ipaddress socketserver
_codecs_kr base64 itertools something
_codecs_tw bdb json sqlite3
_collections binascii keyword sre_compile
_collections_abc binhex lib2to3 sre_constants
_compat_pickle bisect linecache sre_parse
_compression builtins locale ssl
_crypt bz2 logging stat
_csv cProfile lzma statistics
_ctypes calendar macpath string
您也可以通过搜索匹配的词来缩小范围。例如,您想查找可能匹配 "collections":
的内容>>> help('modules collections')
Here is a list of modules whose name or summary contains 'collections'.
If there are any, enter a module name to get more help.
_collections - High performance data structures.
_collections_abc - Abstract Base Classes (ABCs) for collections, according to PEP 3119.
collections
collections.__main__
collections.abc
test.test_collections - Unit tests for collections.py.
test.test_defaultdict - Unit tests for collections.defaultdict.
pip._vendor.requests.packages.urllib3._collections
然后,如果您需要有关特定模块的帮助,以获取有关它的更多信息,您只需调用该特定模块的帮助:
>>> help('collections')