在 occm_web_launcher.py 中添加
#!/usr/bin/env python3
"""OCCM Web 启动器 — PyInstaller 打包入口"""
import sys
import os
PyInstaller 打包后的路径修正
if getattr(sys, "frozen", False):
_base = sys._MEIPASS # type: ignore[attr-defined]
os.chdir(_base)
sys.path.insert(0, _base)
启动 occm_web 包
try:
from occm_web.main import * # noqa: F401,F403
except KeyboardInterrupt:
# 优雅退出,不显示错误
print("\n[OCCM Web] 已停止")
sys.exit(0)
在 occm_web_launcher.py 中添加
#!/usr/bin/env python3
"""OCCM Web 启动器 — PyInstaller 打包入口"""
import sys
import os
PyInstaller 打包后的路径修正
if getattr(sys, "frozen", False):
_base = sys._MEIPASS # type: ignore[attr-defined]
os.chdir(_base)
sys.path.insert(0, _base)
启动 occm_web 包
try:
from occm_web.main import * # noqa: F401,F403
except KeyboardInterrupt:
# 优雅退出,不显示错误
print("\n[OCCM Web] 已停止")
sys.exit(0)