Files
ai_wht_wechat/go_backend/service/python_utils.go

17 lines
411 B
Go
Raw Normal View History

2025-12-19 22:36:48 +08:00
package service
import (
"path/filepath"
"runtime"
)
// getPythonPath 获取虚拟环境中的Python解释器路径(跨平台)
func getPythonPath(backendDir string) string {
if runtime.GOOS == "windows" {
// Windows: venv\Scripts\python.exe
return filepath.Join(backendDir, "venv", "Scripts", "python.exe")
}
// Linux/Mac: venv/bin/python
return filepath.Join(backendDir, "venv", "bin", "python")
}