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;
                    myProcess.StartInfo.UseShellExecute = false;
                    myProcess.StartInfo.RedirectStandardOutput = true;
                    myProce
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章