C# 调用批python 脚本
2007-07-27 15:00
459 查看
1.加命名空间
using System.Diagnostics;
2.实现例子
try
...{
string myDocumentsPath = AppDomain.CurrentDomain.RelativeSearchPath;
myProcess.StartInfo.FileName =myDocumentsPath+ /views.py; //指定python文件
myProcess.StartInfo.Arguments = picname + " " + style; //带参数
myProcess.StartInfo.CreateNoWindow =true;
myProcess.StartInfo.UseShellExecute = false;
myProcess.Start(); //启动
//
myProcess.WaitForExit();
// Label1.Text = "Python script is successfully executed!";
}
catch (Exception er)
...{
Label1.Text = er.ToString();
}
using System.Diagnostics;
2.实现例子
try
...{
string myDocumentsPath = AppDomain.CurrentDomain.RelativeSearchPath;
myProcess.StartInfo.FileName =myDocumentsPath+ /views.py; //指定python文件
myProcess.StartInfo.Arguments = picname + " " + style; //带参数
myProcess.StartInfo.CreateNoWindow =true;
myProcess.StartInfo.UseShellExecute = false;
myProcess.Start(); //启动
//
myProcess.WaitForExit();
// Label1.Text = "Python script is successfully executed!";
}
catch (Exception er)
...{
Label1.Text = er.ToString();
}
相关文章推荐
- Python脚本调用C#代码数据交互示例(hello world)
- C#调用Python脚本的简单示例
- C#调用Python脚本的简单示例
- 【.NET调用Python脚本】C#调用python requests类库报错 'module' object has no attribute '_getframe' - IronPython 2.7
- 使用C#调用Python脚本,带参数列表 z
- 【转】C#中调用python脚本
- C#调用python脚本
- C#调用Python脚本并使用Python的第三方模块
- C#调用Python脚本并使用Python的第三方模块
- C#调用Python脚本的简单示例,IronPython(转载)
- 在VS2017中用C#调用python脚本
- C# 调用 python脚本
- C#调用Python脚本并使用Python的第三方模块
- IronPython脚本调用C#实现的dll库
- C#调用Python脚本的简单示例
- C# 调用 python脚本
- C#调用Python脚本并使用Python的第三方模块
- C#调用Python 脚本语言
- C#如何调用Python执行脚本,并将执行结果显示值显示至C#界面
- 在C#中调用python脚本,并使用python第三方arcpy模块