zipapp — 管理可执行文件 Python zip 存档

Added in version 3.5.

源代码: Lib/zipapp.py


This module provides tools to manage the creation of zip files containing Python code, which can be executed directly by the Python interpreter . The module provides both a 命令行接口 Python API .

Basic Example

以下范例展示如何 命令行接口 can be used to create an executable archive from a directory containing Python code. When run, the archive will execute the main function from the module myapp in the archive.

$ python -m zipapp myapp -m "myapp:main"
$ python myapp.pyz
<output from myapp>