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

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

问题描述

我已经尝试使用 py2exe(与 ipy 不兼容)和 PYC(过时).谁能给我指出一个好的编译器的方向?

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?

推荐答案

您可以使用 pyc.pyPython 命令行编译器,自 2.6 版起包含在 IronPython 中进行编译一个 Python 脚本到一个可执行文件.您可以在硬盘上的 %IRONPYTONINSTALLDIR%ToolsScriptspyc.py 中找到它.

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%ToolsScriptspyc.py on your hard disk.

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

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 ToolsScriptspyc.py /main:test.py /target:exe

注意:如果您正在使用表单并且不想打开控制台窗口,您需要使用 /target:winexe 而不是 /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.

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

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
  • IronPython.Modules.dll(有时需要).
  • 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).

另见博客条目 IronPython - 如何编译 exe.

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

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