gpt4 book ai didi

python - py2app 处方

转载 作者:太空宇宙 更新时间:2023-11-03 11:36:05 28 4
gpt4 key购买 nike

py2app documentation提到了 prescripts,在主 python 脚本之前由 __boot__.py 运行。我找不到在 setup.py 文件或构建过程中轻松指定任何规定的方法。

不过,我确实设法“破解”了 __boot__.py 并在我的主要 _run(main_script) 之前添加了另一个 _run(prescript) 命令> 它似乎工作正常。然而,使用标准的 py2app 构建过程会好得多。

我基本上想做的是在启动主脚本之前猴子修补我的 sites-packages.zip 文件。该脚本实质上是检查服务器上的更新,如果有更新,则下载它们,然后覆盖 site-packages.zip 文件。比从头开始重新安装应用程序要快得多。

有什么想法吗?

最佳答案

参见 the docs : 你的 py2app.recipes 包必须包含一个食谱,其 check 方法返回一个 dict 包括 'prescripts' 键其值(value)是,我引用,

A list of additional Python scripts to run before initializing the main script. This is often used to monkey-patch included modules so that they work in a frozen environment. The prescripts may be module names, file names, or file-like objects containing Python code (e.g. StringIO). Note that if a file-like object is used, it will not currently be scanned for additional dependencies.

参见 the built-in recipes sources举些例子。这个包(安装在您的机器上)是您需要添加自己的自定义配方的地方。

关于python - py2app 处方,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2544619/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com