go gin框架调用cmd运行python脚本问题
报错1:exec: “python3 test.py”: executable file not found in $PATH
在单个go程序中直接执行以下脚本没有问题
func TestCmdPython(t *testing.T) {
//test.txt的内容为图片的base64字符串
//filePath := "test.txt"
//newFileName := "test.jpg"
//CmdPythonSaveImageDpi(filePath,newFileName)
cmd := exec.Command("python3 test.py")
//cmd.Dir, _ = os.Getwd()
fmt.Println("cmd.Path:",cmd.Path)
fmt.Println("cmd.Dir:",cmd.Dir)
//out,err := cmd.Output()
}

![go gin框架调用cmd运行python脚本问题[编程语言教程]](https://www.zixueka.com/wp-content/uploads/2024/01/1706714399-60bb5af1456bb97.jpg)
