精简使用py2app构建的Python wxPython OS X应用程序? [英] Slim down Python wxPython OS X app built with py2app?

查看:137
本文介绍了精简使用py2app构建的Python wxPython OS X应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚用py2app制作了一个Python wxPython脚本的小程序.一切都按广告宣传进行,但该应用程序的尺寸很大.有什么方法可以优化py2app以使其尺寸更小?

I have just made a small little app of a Python wxPython script with py2app. Everything worked as advertised, but the app is pretty big in size. Is there any way to optimize py2app to make the app smaller in size?

推荐答案

这是一种解决方法.

这取决于您要定位的操作系统. Python和wxPython与每个Mac OS X安装捆绑在一起(如果我没记错的话,至少从Leopard开始)

It will depend on which OS you want to target. Python and wxPython are bundled with every Mac OS X installation (at least starting with Leopard, if I recall correctly)

您可能会尝试添加--alias编译选项.根据 py2app文档 :

What you might try, is to add the --alias compilation option. According to the py2app doc:

别名模式(-A或--alias选项)指示py2app构建一个应用程序包,该应用程序包就地使用您的源文件和数据文件.

Alias mode (the -A or --alias option) instructs py2app to build an application bundle that uses your source and data files in-place.

以便该应用将尝试使用wxPython的Mac OS X版本.

So that the app will try to use the Mac OS X version of wxPython.

谨慎
别名选项称为开发模式.

CAREFUL
The alias option is called development mode.

如果您使用的不是Mac OS X随附的另一个库,则将无法使用.
如果要将应用程序移植到Windows或Linux,将无法使用.

If you use another library that is not bundled with Mac OS X, it won't work.
If you want to port your application to Windows or Linux, it won't work.

我已经成功地使用了这种方法,但最后,还是回到了压缩30/40MB文件的位置.到底哪个不那么大.

I've had some successful use with this method but in the end, went back to zipping a 30/40MB file. Which in the end is not that big.

这篇关于精简使用py2app构建的Python wxPython OS X应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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