我可以通过dotnetcore的本地代码运行python脚本,但是当我在本地机器上托管相同的代码时,它不会运行python脚本

2024-04-29 03:48:08 发布

您现在位置:Python中文网/ 问答频道 /正文

Code Image我使用的是dotnet核心web API,如果我在本地调试代码。但是当我在本地机器上托管webapi时,只有Python脚本不能正常工作,其余的都正常工作。你知道吗

var file = Configuration.GetValue<string>("DE.PythonPath");
        ProcessStartInfo start = new ProcessStartInfo();
        start.FileName = file;
        start.Arguments = string.Format("{0} {1}", cmd, args);
        start.UseShellExecute = false;
        start.RedirectStandardOutput = true;
Process process = Process.Start(start)
StreamReader reader = process.StandardOutput
var result = reader.ReadToEnd();
                return result;

我想通过托管代码运行python脚本。你知道吗


Tags: image脚本web核心stringvarcoderesult