Logo

上一个主题

codeop --- 编译Python代码

下一个主题

zipimport --- 从 Zip 存档中导入模块

当前页面

  • 提交 Bug
  • 显示源码

导航

  • 索引
  • 模块 |
  • 下一页 |
  • 上一页 |
  • python logo
  • Python »
  • Python 3.12.0a0 文档 »
  • Python 标准库 »
  • 导入模块
  • |

导入模块¶

本章中介绍的模块提供了导入其他Python模块和挂钩以自定义导入过程的新方法。

本章描述的完整模块列表如下:

  • zipimport --- 从 Zip 存档中导入模块
    • zipimporter 对象
    • 例子
  • pkgutil --- 包扩展工具
  • modulefinder --- 查找脚本使用的模块
    • ModuleFinder 的示例用法
  • runpy ——查找并执行 Python 模块
  • importlib --- import 的实现
    • 概述
    • 函数
    • importlib.abc —— 关于导入的抽象基类
    • importlib.machinery —— 导入器和路径钩子函数。
    • importlib.util —— 导入器的工具程序代码
    • 例子
      • 用编程方式导入
      • 检查某模块可否导入。
      • 直接导入源码文件。
      • 实现延迟导入
      • 导入器的配置
      • importlib.import_module() 的近似实现
  • importlib.resources -- Resources
  • Using importlib.metadata
    • 概述
    • 功能性 API
      • Entry points
      • Distribution metadata
      • Distribution versions
      • Distribution files
      • Distribution requirements
      • Package distributions
    • Distributions
    • Extending the search algorithm
  • The initialization of the sys.path module search path
    • Virtual environments
    • _pth files
    • Embedded Python

上一个主题

codeop --- 编译Python代码

下一个主题

zipimport --- 从 Zip 存档中导入模块

当前页面

  • 提交 Bug
  • 显示源码
«

导航

  • 索引
  • 模块 |
  • 下一页 |
  • 上一页 |
  • python logo
  • Python »
  • Python 3.12.0a0 文档 »
  • Python 标准库 »
  • 导入模块
  • |
© 版权所有 2001-2022, Python Software Foundation.
This page is licensed under the Python Software Foundation License Version 2.
Examples, recipes, and other code in the documentation are additionally licensed under the Zero Clause BSD License.
See History and License for more information.

The Python Software Foundation is a non-profit corporation. Please donate.

最后更新于 5月 26, 2022. Found a bug?
由 Sphinx 4.5.0创建。