fix: 使用 --paths 参数修复 PyInstaller 导入路径问题
- 改用 --paths=src 代替 --add-data - 这样 src 目录会被添加到 Python 路径 - 避免 processor 等模块导入错误 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -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",
|
||||
]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user