在Gitlab CI/CD管道中使用'cx_Freeze'创建MSI安装程序时出现无效命令'bdist_msi
我正在使用 py setup.py bdist_msi
来为我的 Python 应用程序生成一个 Windows 单个可执行文件。在我的电脑上这个方法很好用,但在 GitLab 的流水线中执行时就不行了。有没有人知道怎么解决这个问题?我在本地和流水线中都使用的是 Python 3.11.8。这里是错误信息:

这是我的 setup.py 文件:
from cx_Freeze import setup, Executable
import sys
directory_table = [("ProgramMenuFolder", "TARGETDIR", "."),
("MyProgramMenu", "ProgramMenuFolder", "MYPROG~1|My Program")]
msi_data = {"Directory": directory_table,
"ProgId": [("Prog.Id", None, None, "This is a description", "IconId", None)],
"Icon": [("IconId", "matplotlib.ico")]}
files = ['param_list.py', 'mca_ioconfig_parser.py', 'mca_package_manifest_parser.py', 'mca_rti_log_parser.py',
'ui_interface.py', 'resources_rc.py']
bdist_msi_options = {"add_to_path": False,
"data": msi_data,
'initial_target_dir': r'[ProgramFilesFolder]%s' % 'yammiX',
"upgrade_code": "{96a85bac-52af-4019-9e94-3afcc9e1ad0c}"}
build_exe_options = {"excludes": [], "includes": []}
executables = Executable(script="toolName.py",
base="Win32GUI" if sys.platform == "win32" else None,
icon="matplotlib.ico",
shortcut_name="toolName",
shortcut_dir="DesktopFolder")
setup(name="toolName",
version="0.1.5",
author="toolName",
description="",
executables=[executables],
options={"build_exe": build_exe_options,
"bdist_msi": bdist_msi_options})
这是我的 yml 文件:
image: python:3.11.8
stages:
- build
- test
- deploy
build-job:
stage: build
# Update stuff before building versions
before_script:
- apt-get update -q -y
- apt install -y python3-pip
- apt install -y python3-venv
- python3 -m venv .venv
- source .venv/bin/activate
- python3 --version
- python3 -m pip install -r requirements.txt
script:
- python3 setup.py -q bdist_msi
artifacts:
paths:
- build/
unit-test-job:
stage: test
script:
- echo "Running unit tests... This will take about few seconds."
- echo "Code coverage is 100%"
deploy-job:
stage: deploy
script:
- echo "Deploying application..."
- echo "Application successfully deployed."
1 个回答
暂无回答