py2exe“包含"模块:什么时候应该手动管理它们? [英] py2exe "include" modules: when should they be managed manually?

查看:36
本文介绍了py2exe“包含"模块:什么时候应该手动管理它们?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么时候需要指定要包含的模块?不 py2exe 搜索并包含任何需要的内容:http://www.py2exe.org/index.cgi/常见问题解答?

When is it necessary to specify modules to include? Doesn't py2exe search and include whatever is needed per: http://www.py2exe.org/index.cgi/FAQ?

为什么它包含未使用的模块,例如 ["Tkconstants"、"Tkinter"、"tcl"、"wx"](我正在使用 Qt,但在我的 PC 上安装了 wx)那么需要排除吗?

And why does it include modules that are not being used, such as ["Tkconstants", "Tkinter", "tcl", "wx"] (I'm using Qt, but have wx installed on my PC) that then need to be excluded?

推荐答案

py2exe 尝试创建所有依赖项的图表,从您的入口点脚本开始.它并不总是 100% 正确,这就是为什么为您提供 includesexcludes 选项来微调包的原因.

py2exe tries to create a graph of all the dependencies, starting with your entry point script. It can't always get it 100% correct, which is why you are provided the includes and excludes options to fine tune the package.

参考这里的选项:http://www.py2exe.org/index.cgi/ListOfOptions

有时您不想要的模块会被包含在内,如果发生这种情况,只需将它们添加到排除项中即可.我想你的问题的答案是:当开箱即用的选项不能完全按照你想要的方式打包时,手动管理 setup.py.

Sometimes modules you didn't want will get included and if this happens just add them to the exclude. I suppose the answer to your question would be: manage the setup.py manually when the out-of-the box options don't package it exactly how you want.

py2exe 的帮助文件实际上包含了一堆提示和技巧……其中一个专门解决了包含 Tk 的问题:http://www.py2exe.org/index.cgi/TkInter

The help files for py2exe actually include a bunch of tips and tricks... one specifically addressing your issue with Tk being included: http://www.py2exe.org/index.cgi/TkInter

提示和技巧的索引在这里:http://www.py2exe.org/index.cgi/Py2Exe

The index of the tips and tricks is here: http://www.py2exe.org/index.cgi/Py2Exe

我已经使用非常相似的 py2app 为 osx 构建了大量应用程序.在不同版本的过程中,有时它们会改变发现依赖关系的方式.它还使用各种食谱"来处理诸如 Qt 之类的某些包.一个较新版本的 p2app 突然开始包含所有 PyQt 模块,而不仅仅是我使用的两个模块.所以,我不得不将它们添加到我的排除项中.

I've built a ton of apps using the very similar py2app for osx. Over the course of different versions, sometimes they change the way it discovers dependencies. It also uses various "recipes" for how to handle certain packages like Qt. A newer version of p2app suddenly started including all of the PyQt modules instead of just the two I used. So, I had to add them to my excludes.

这篇关于py2exe“包含"模块:什么时候应该手动管理它们?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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