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() }