無法加載文件或程序集“python.runtime”或其依賴項(xiàng)之一,嘗試加載格式正確的程序我面臨同樣的問題,我的錯(cuò)誤沒有使用 phyton 3.5 解決,調(diào)用 phyton.exe 路徑在 .net c# 控制器中執(zhí)行 phyton 文件,只有在發(fā)布到服務(wù)器后才會遇到錯(cuò)誤,它在我的系統(tǒng)中工作正常下面是我的代碼if (Result.Success){ System.Diagnostics.Process process = new System.Diagnostics.Process(); System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo(); startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; startInfo.FileName = "C:/Program Files/Python 3.5/python.exe"; startInfo.Arguments = "C:/PythonScripts/Test.py"; // startInfo.Arguments = HttpContext.Server.MapPath("~/PythonScripts/Test.py").ToString(); startInfo.Verb = "runas"; startInfo.UseShellExecute = false; startInfo.RedirectStandardError = true; startInfo.RedirectStandardOutput = true; process.StartInfo = startInfo; bool t = process.Start(); StreamReader myStreamReader = process.StandardError; string error = myStreamReader.ReadToEnd(); StreamReader reader = process.StandardOutput; string output = reader.ReadToEnd(); process.WaitForExit(); process.Close(); if (!error.Equals("")) { Result.Success = false; Result.Exception = true; }}
1 回答

吃雞游戲
TA貢獻(xiàn)1829條經(jīng)驗(yàn) 獲得超7個(gè)贊
沒有太多關(guān)于您正在使用的信息,但有時(shí),這badformatexception
是因?yàn)槟捻?xiàng)目配置與它抱怨的 dll 不兼容,請將其更改為 x86 或 x64。
- 1 回答
- 0 關(guān)注
- 186 瀏覽
添加回答
舉報(bào)
0/150
提交
取消