Logo

上個主題

codeop --- 编译Python代码

下個主題

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

此頁面

  • 回報錯誤
  • 顯示原始碼

瀏覽

  • 索引
  • 模組 |
  • 下一頁 |
  • 上一頁 |
  • python logo
  • Python »
  • 3.11.2 Documentation »
  • Python 標準函式庫 (Standard Library) »
  • 匯入模組
  • |

匯入模組¶

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

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

  • zipimport --- 从 Zip 存档中导入模块
    • zipimporter 物件
    • 範例
  • pkgutil --- 包扩展工具
  • modulefinder --- 查找脚本使用的模块
    • ModuleFinder 的示例用法
  • runpy ——查找并执行 Python 模块
  • importlib --- import 的实现
    • 簡介
    • 函式
    • importlib.abc —— 关于导入的抽象基类
    • importlib.machinery —— 导入器和路径钩子函数。
    • importlib.util —— 导入器的工具程序代码
    • 範例
      • 用编程方式导入
      • 检查某模块可否导入。
      • 直接导入源码文件。
      • 实现延迟导入
      • 导入器的配置
      • importlib.import_module() 的近似实现
  • importlib.resources -- Resources
  • 已棄用函式
  • importlib.resources.abc -- Abstract base classes for resources
  • 使用 importlib.metadata
    • 概述
    • 功能性 API
      • 入口点
      • 分发的元数据
      • 分发的版本
      • 分发的文件
      • 分发的依赖
      • Mapping import to distribution packages
    • 分发
    • Distribution Discovery
    • 扩展搜索算法
  • The initialization of the sys.path module search path
    • Virtual environments
    • _pth files
    • Embedded Python

上個主題

codeop --- 编译Python代码

下個主題

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

此頁面

  • 回報錯誤
  • 顯示原始碼

瀏覽

  • 索引
  • 模組 |
  • 下一頁 |
  • 上一頁 |
  • python logo
  • Python »
  • 3.11.2 Documentation »
  • Python 標準函式庫 (Standard Library) »
  • 匯入模組
  • |
© 版權 2001-2023, 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.

最後更新於 3月 23, 2023。 Found a bug?
使用 Sphinx 4.5.0 建立。