目前的最新版本是:3.4.1
安装
Install-Package IronPython
如果需要使用标准库,则进行下面的安装
Install-Package IronPython.StdLib
在C#程序中执行Python代码
示例代码:
var eng = IronPython.Hosting.Python.CreateEngine(); var scope = eng.CreateScope(); eng.Execute(@" def greetings(name): return 'Hello ' + name.title() + '!' ", scope); dynamic greetings = scope.GetVariable("greetings"); System.Console.WriteLine(greetings("world"));
参考网址
https://ironpython.net/
https://github.com/IronLanguages/ironpython3
标签:eng,C#,开发,greetings,https,scope,IronPython From: https://www.cnblogs.com/wzwyc/p/17551126.html