使用命令运行python脚本

C#调用Python脚本(Process)

 

 

同样的可以用代码来实现

 1             Process p = new Process();
 2             string path = System.Web.HttpContext.Current.Server.MapPath("../Python/0610.py"); ;
 3             string sArguments = path;
 4             p.StartInfo.FileName = @"D:\tools\Anaconda3\python.exe"; 
 5             p.StartInfo.Arguments = sArguments;//python命令的参数
 6             p.StartInfo.UseShellExecute = false;
 7             p.StartInfo.RedirectStandardOutput = true;
 8             p.StartInfo.RedirectStandardInput = true;
 9             p.StartInfo.RedirectStandardError = true;
10             p.StartInfo.CreateNoWindow = true;
11             p.Start();

 

相关文章:

  • 2021-05-10
  • 2021-05-16
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-10
猜你喜欢
  • 2021-09-04
  • 2021-05-17
  • 2022-01-27
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-19
相关资源
相似解决方案