更新时间:2026-01-08 GMT+08:00
使用PyInstaller构建
使用PyInstaller工具构建Python项目。
图形化构建
在配置构建步骤中,添加“PyInstaller构建”构建步骤。
参数说明如下:
| 参数项 | 说明 |
|---|---|
| 步骤显示名称 | 构建步骤的名称,可自定义修改。 |
| 工具版本 | 请根据需要选择工具版本。 |
| 命令 | 配置构建打包命令,默认命令是将项目打包成一个可执行文件,PyInstaller具体的命令可以查看官网文档。 |
代码化构建
1 2 3 4 5 6 7 8 9 10 11 12 13 | version: 2.0 # 必须是2.0 steps: BUILD: - python: name: PyInstaller构建 image: cloudbuild@python3.6 inputs: command: | pip config set global.index-url https://pypi.org/simple pip config set global.trusted-host repo.xxcloud.com # -F创建单一的可执行文件,文件位置在dist目录下 # 详细命令参见: https://pyinstaller.readthedocs.io/en/stable/usage.html pyinstaller -F *.py |
| 参数名 | 参数类型 | 描述 | 是否必填 | 默认值 |
|---|---|---|---|---|
| name | / | 构建步骤名称,可自定义。 | 否 | 无 |
| image | / | 镜像版本,“cloudbuild@”为固定部分,后面为支持的Python版本,可在“图形化”构建中查看PyInstaller构建支持的“工具版本”。 | 否 | cloudbuild@python3.6 |
| command | string | 执行命令。可根据实际需要输入相关代码。 | 是 | 无 |
父主题: 配置构建步骤