import subprocess import os # 获取当前脚本所在的目录(即 AutoAnno 目录) base_dir = os.path.dirname(os.path.abspath(__file__)) # 组装相对路径 python_exe = os.path.join(base_dir, ".venv", "Scripts", "python.exe") script_path = os.path.join(base_dir, "autoannoguinew.py") # 后台静默执行 subprocess.Popen( [python_exe, script_path], creationflags=subprocess.CREATE_NO_WINDOW, cwd=base_dir )