py2exe gtk 从目录执行脚本
您好,我正在构建一个简单的应用程序,它将有一个组合框来选择位于脚本目录中的 python 脚本,以在数据库上创建报告。我打算使用 py2exe 来构建程序,这样用户就不必安装 python 和子模块。
那么我该如何让程序使用 py2exe dist 运行这些脚本呢?
我考虑过使用 system('command') 并从安装目录复制 python.exe 来运行 system(os.curdir+'python.exe ' + script_to_run) 然后 python.exe 将使用 python 的本地副本。 dll 和它需要运行的库(即 reportlab 和 pyobdc)可以
工作还是有更好的方法?
(如果更容易的话,我也不介意用ironpython构建它)
Hi I am building a simple application that will have a combo box to select python scripts that are in a directory called scripts to create reports on a database. I was going to use py2exe to build the program so that the users don't have to have python and submoduals installed.
so how would i go about having the program run these scripts using the py2exe dist?
i thought about using system('command') and copying the python.exe from my install directory to just run system(os.curdir+'python.exe ' + script_to_run) the python.exe would then use the local copy of the python.dll and the libs that it needs to run which would just be reportlab and pyobdc
would that work or is there a better way?
(i also wouldn't mind building it in ironpython if that would be easier)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Micheal Foord 有以下示例从 Ironpython 中嵌入 Ironpython
基本步骤是创建您的 shell 应用程序。对于真正的轻量级 GUI,有 EasyWPF。使用 pyc 将脚本编译为 exe,将标准库编译为 DLL。根据您是否需要从脚本中捕获标准输出或将信息中的变量传递给脚本,事情可能会变得更加复杂,如本文所述。下面列出了一个基本示例。
Micheal Foord has the following example for Embedding Ironpython from within Ironpython
The basic steps are to create your shell application. For a real lightweight GUI there is EasyWPF. Use pyc to compile your script to an exe and the standard library into a DLL. Depending on if you need to capture stdout from the scripts or pass variables in information into them, things can get more complicated as indicated in the article. A basic example is listed below.