From 299504c2833b82d77fbecbd38506b953c6838494 Mon Sep 17 00:00:00 2001 From: "let5sne.win10" Date: Thu, 12 Feb 2026 23:06:44 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BD=BF=E7=94=A8=20--paths=20=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E4=BF=AE=E5=A4=8D=20PyInstaller=20=E5=AF=BC=E5=85=A5?= =?UTF-8?q?=E8=B7=AF=E5=BE=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 改用 --paths=src 代替 --add-data - 这样 src 目录会被添加到 Python 路径 - 避免 processor 等模块导入错误 Co-Authored-By: Claude Opus 4.6 --- build_exe.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/build_exe.py b/build_exe.py index ea5bec5..9def9df 100644 --- a/build_exe.py +++ b/build_exe.py @@ -11,13 +11,14 @@ PROJECT_ROOT = Path(__file__).parent def build(): - """使用 PyInstaller 打包(使用 Python -m 方式兼容性更好)""" + """使用 PyInstaller 打包""" print("正在打包,请稍候...") print(f"工作目录: {PROJECT_ROOT}") print("-" * 50) - # 使用 Python -m PyInstaller 方式,兼容性更好 + # 使用 Python -m PyInstaller 方式 + # --paths 将 src 目录添加到 Python 路径,避免导入问题 cmd = [ sys.executable, "-m", "PyInstaller", @@ -26,7 +27,7 @@ def build(): "--windowed", "--clean", "--noconfirm", - "--add-data=src;src", + "--paths=src", "src/desktop.py", ]