first commit
This commit is contained in:
16
go_backend/service/python_utils.go
Normal file
16
go_backend/service/python_utils.go
Normal file
@@ -0,0 +1,16 @@
|
||||
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")
|
||||
}
|
||||
Reference in New Issue
Block a user