Ironpython 2.6.py - > 。可执行程序 [英] Ironpython 2.6 .py -> .exe

查看:352
本文介绍了Ironpython 2.6.py - > 。可执行程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经尝试使用py2exe(与ipy不兼容)和PYC(过期)。

解决方案

您可以使用 pyc.py a>, Python命令行编译器,它包含在IronPython 2.6版本中,用于将Python脚本编译为可执行文件。您可以在硬盘上的%IRONPYTONINSTALLDIR%\Tools\Scripts\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ > Example

让我们假设你有一个简单的脚本 test.py ,只是打印出一些东西给控制台。您可以使用以下命令行(假设IronPython目录是当前目录,并且 test.py 也在其中)将其转换为可执行文件:

  ipy.exe Tools \Scripts\pyc.py /main:test.py / target:exe 

注意:如果您使用表单而不想打开控制台窗口, c $ c> / target:winexe 而不是 / target:exe



结果将是两个文件, test.dll test.exe test.dll 将包含您的实际脚本代码,而 test.exe 只是一个启动器 test.dll 。如果包括文件,您可以将此EXE和DLL分发到其他未安装IronPython的计算机。




  • IronPython .dll

  • Microsoft.Dynamic.dll

  • Microsoft.Scripting.Core.dll

  • Microsoft.Scripting.Debugging.dll

  • Microsoft.Scripting.dll

  • Microsoft.Scripting.ExtensionAttribute.dll

  • IronPython.Modules.dll (有时需要)。



另请参阅博客条目 IronPython - 如何编译exe


I already attempted using py2exe (not compatible with ipy) and PYC (out of date). Can anyone point me in the direction of a good compiler?

解决方案

You can use pyc.py, the Python Command-Line Compiler, which is included in IronPython since version 2.6 to compile a Python script to an executable. You find it at %IRONPYTONINSTALLDIR%\Tools\Scripts\pyc.py on your hard disk.

Example

Let's assume you have a simple script test.py that just prints out something to console. You can turn this into an executable with the following command-line (assuming that the IronPython directory is the current directory and that test.py is in there, too):

ipy.exe Tools\Scripts\pyc.py /main:test.py /target:exe

Note: If you are using forms and don't want a console window to open, you want to use /target:winexe instead of /target:exe.

The result will be two files, test.dll and test.exe. test.dll will contain your actual script code, while test.exe is just a launcher for test.dll. You can distribute this EXE and DLL to other computers which do not have IronPython installed if you include the files

  • IronPython.dll,
  • Microsoft.Dynamic.dll,
  • Microsoft.Scripting.Core.dll,
  • Microsoft.Scripting.Debugging.dll,
  • Microsoft.Scripting.dll,
  • Microsoft.Scripting.ExtensionAttribute.dll and
  • IronPython.Modules.dll (sometimes needed).

Also see the blog entry IronPython - how to compile exe.

这篇关于Ironpython 2.6.py - > 。可执行程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆