问题描述
I'm soon to launch a beta app and this have the option to create custom integration scripts on Python.
该应用程序将面向 Mac OS X 和 Windows,而我的问题是 Windows,其中 Python通常不存在.
The app will target Mac OS X and Windows, and my problem is with Windows where Python normally is not present.
我的实际方法是静默运行 Python 2.6 安装.但是我遇到了默认情况下未激活的问题,并且在使用 时未设置路径命令行选项.而且我担心如果之前安装了 Python 并且我升级到新版本,这可能会破坏其他东西......
My actual aproach is silently run the Python 2.6 install. However I face the problem that is not activated by default and the path is not set when use the command line options. And I fear that if Python is installed before and I upgrade to a new version this could break something else...
所以,我想知道如何干净利落地做到这一点.如果我复制整个 Python 2.6 目录,并将其放在我的应用程序的子目录中并在那里安装所有内容,是否可以?或者使用 virtualenv 可以运行不同版本的 Python(如果 Python 已经安装在机器中?).
So, I wonder how this can be done cleanly. Is it OK if I copy the whole Python 2.6 directory, and put it in a sub-directory of my app and install everything there? Or with virtualenv is posible run diferents versions of Python (if Python is already installed in the machine?).
我在用DLL嵌入Python之前也玩过,觉得很容易,但是我失去了调试的能力,所以我改用命令行插件了.
I also play before embedding Python with a DLL, and found it easy but I lost the ability to debug, so I switch to command-line plug-ins.
我从命令行执行插件并读取 STDOUT 和 STDERR 输出.该应用程序是用 Delphi/Lazarus 制作的.我安装其他模块,如 JSON 和 RPC 客户端、Win32com、ORM 等.我使用 bitrock 创建安装程序.
I execute the plug-ins from command line and read the STDOUT and STDERR output. The app is made with Delphi/Lazarus. I install others modules like JSON and RPC clients, Win32com, ORM, etc. I create the installer with bitrock.
更新:最终用户是小企业主,Python 脚本由开发人员制作.我想避免部署中的任何额外步骤,所以我想要一个完全集成的设置.
UPDATE: The end-users are small business owners, and the Python scripts are made by developers. I want to avoid any additional step in the deployment, so I want a fully integrated setup.
推荐答案
复制一个 Portable Python 文件夹您的安装程序,放入与 Delphi/Lazarus 应用程序相同的文件夹中.为此适当设置所有路径.
Copy a Portable Python folder out of your installer, into the same folder as your Delphi/Lazarus app. Set all paths appropriately for that.
这篇关于如何将 Python 部署到 Windows 用户?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!