亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如果單獨運行python就沒有問題,這是為什么?。糠粗筒豢梢?/h1>

如果單獨運行python就沒有問題,這是為什么?。糠粗筒豢梢?/h1>
C#
慕森王 2023-04-17 21:17:42
我在一個winform的c#程序里通過process調用python程序,這個python程序里有多線程?,F在問題是我調用的python程序可以跑,但是跑一會就不能運行了,但是我如果單獨運行python就沒有問題,這是為什么。ic void RunPythonScript(string path, string args = "")         {             path = System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase + "script\\" + path;                          p.StartInfo.FileName = "python.exe";            string sArguments = "\"" + path + "\"";             if (args.Length > 0)             {                 sArguments += " " + args;             }             //p.StartInfo.WorkingDirectory = "D:\\";             p.StartInfo.Arguments = sArguments;             p.StartInfo.UseShellExecute = false;             p.StartInfo.RedirectStandardOutput = true;             p.StartInfo.RedirectStandardInput = true;             p.StartInfo.RedirectStandardError = true;             p.StartInfo.CreateNoWindow = true;             p.Start();             //p.CloseMainWindow();             //p.WaitForExit();         }`
查看完整描述

1 回答

?
jeck貓

TA貢獻1909條經驗 獲得超7個贊

把下面的這行代碼取消注釋就可以了。前提你這個操作是在主線程之外。不然會阻塞。

//p.WaitForExit();


查看完整回答
反對 回復 2023-04-20
  • 1 回答
  • 0 關注
  • 148 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號