c#调用python应用程序

c#语言调用python编写的应用程序

windows

windows平台下,python打包后的应用程序为.exe程序

  using (Process myProcess = new Process())
                {
                    myProcess.StartInfo.UseShellExecute = false;
                    var guid = System.Guid.NewGuid().ToString();
                    var jsonfile = guid + ".json";
                    string jsonPath = ProjectPath + @"python\dist\json\" + jsonfile;
                    File.WriteAllText(jsonPath, jsonData);
                    myProcess.StartInfo.FileName = ProjectPath + @"python\dist\python\python.exe";
                    myProcess.StartInfo.Arguments = jsonfile + " " + resultTemlate + " "+flag + " "+Name;
                    myProcess.StartInfo.CreateNoWindow = true;
                    myProcess.StartInfo.ErrorDialog = false;
                    myPro
posted @ 2020-05-12 13:36  菜鸟阿都  阅读(242)  评论(0)    收藏  举报