class ControlPython{ public void startexe() { Process usepy = new Process(); string path = "\"" + System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase + "\\pyproject.exe" + "\""; usepy.StartInfo.FileName = @"python"; usepy.StartInfo.Arguments = path; usepy.StartInfo.UseShellExecute = false; usepy.StartInfo.RedirectStandardOutput = true; usepy.StartInfo.RedirectStandardInput = true; usepy.StartInfo.RedirectStandardError = true; usepy.StartInfo.CreateNoWindow = false; usepy.OutputDataReceived += (sender, args) => Console.WriteLine("received output: {0}", args.Data); usepy.Start(); sepy.BeginOutputReadLine(); Console.ReadLine(); }