fix: derive sage_root from script location instead of hardcoded path

This commit is contained in:
yumoqing 2026-05-30 13:41:01 +08:00
parent e494c88977
commit 5ec5946a90

View File

@ -24,8 +24,9 @@ import argparse
import sys
import os
# 确保 Sage 虚拟环境的包可用
sage_root = os.path.expanduser('~/repos/sage')
# 从脚本位置推断 sage 根目录(脚本在 pkgs/llmage/scripts/ 下)
_script_dir = os.path.dirname(os.path.abspath(__file__))
sage_root = os.path.abspath(os.path.join(_script_dir, '..', '..', '..'))
sys.path.insert(0, sage_root)
sys.path.insert(0, os.path.join(sage_root, 'py3/lib/python3.10/site-packages'))