导入模块 ¶
The modules described in this chapter provide new ways to import other Python modules and hooks for customizing the import process.
此章描述的完整模块列表:
-
zipimport— 导入模块从 Zip 存档 -
pkgutil— 包扩展实用程序 -
modulefinder— 查找用于脚本的模块 -
runpy— 定位和执行 Python 模块 -
importlib— 实现为import- 介绍
- 函数
-
importlib.abc– 导入相关 ABC (抽象基类) -
importlib.machinery– 导入器和路径挂钩-
SOURCE_SUFFIXES -
DEBUG_BYTECODE_SUFFIXES -
OPTIMIZED_BYTECODE_SUFFIXES -
BYTECODE_SUFFIXES -
EXTENSION_SUFFIXES -
all_suffixes() -
BuiltinImporter -
FrozenImporter -
WindowsRegistryFinder -
PathFinder -
FileFinder -
SourceFileLoader -
SourcelessFileLoader -
ExtensionFileLoader -
NamespaceLoader -
ModuleSpec -
AppleFrameworkLoader
-
-
importlib.util– 用于导入器的实用程序代码 - 范例
-
importlib.resources– Package resource reading, opening and access -
importlib.resources.abc– 用于资源的抽象基类 -
importlib.metadata– Accessing package metadata -
初始化
sys.path模块搜索路径