简体   繁体   English

将IronPython代码编译为EXE或DLL

[英]Compiling an IronPython code to EXE or DLL

我可以在.NET运行时中将IronPython代码编译为EXE或DLL吗?

Simply use clr.CompileModules in an IronPython script to convert it to a dll file. 只需在IronPython脚本中使用clr.CompileModules将其转换为dll文件即可。 Or you can use pyc.py (found inside of your IronPythonInstallDirectory\\Tools\\Scripts ) which can also generate an exe for you also. 或者你可以使用pyc.py (在你的IronPythonInstallDirectory\\Tools\\Scripts ),它也可以为你生成一个exe。

If I really, really needed that I would create a wrapper DLL/EXE in another language. 如果我真的,真的需要我会用另一种语言创建一个包装器DLL / EXE。 The Python code can then be stored as a resource in the DLL that is loaded when the assembly is first accessed. 然后,Python代码可以作为资源存储在首次访问程序集时加载的DLL中。

Yes you can! 是的你可以! I posted a Python script which can take an IronPython file, figure out its dependencies and compile the lot into a standalone binary at Ironpython 2.6 .py -> .exe . 我发布了一个Python脚本,它可以获取IronPython文件,找出它的依赖关系并将该批量编译成Ironpython 2.6 .py - > .exe中的独立二进制文件。 Hope you find it useful. 希望你觉得它有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM