无法加载文件或程序集“python.runtime”或其依赖项之一,尝试加载格式正确的程序
我面临同样的问题,我的错误没有使用 phyton 3.5 解决,调用 phyton.exe 路径在 .net c# 控制器中执行 phyton 文件,只有在发布到服务器后才会遇到错误,它在我的系统中工作正常
下面是我的代码
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;
}
}

拉丁的传说
吃鸡游戏
随时随地看视频慕课网APP
相关分类