我正在测试不同的语言来开发适用于 Mac 和 Windows 的桌面应用程序。
我觉得Python+Wx值得一试,所以写了一个简单的hello world。
然后,我尝试使用 py2app 将我的应用程序打包为 Mac 应用程序。
令人惊讶的是,我的 hellworld.app 大小高达 75 MB! (然后我在运行时出错,但这不是问题)
这是我的问题:有没有办法分发重量小于几 MB 的独立 wxPython 应用程序? (例如,地址簿应用程序)。
(Swing HelloWorld 大约 3KB,加上 JRE 大约 20MB)
谢谢
最佳答案
我强烈建议您使用 PyINstaller,它可以在这里找到:link
到目前为止,它对我来说就像一个 chamr,它支持大多数主要的库: wxpython pyqt 甚至 django (虽然我不太了解整个 django 支持的事情;-))
PyInstaller is a program that converts (packages) Python programs into stand-alone executables, under Windows, Linux, and Mac OS X. Its main advantages over similar tools are that PyInstaller works with any version of Python since 2.2, it builds smaller executables thanks to transparent compression, it is fully multi-platform, and use the OS support to load the dynamic libraries, thus ensuring full compatibility.
The main goal of PyInstaller is to be compatible with 3rd-party packages out-of-the-box. This means that, with PyInstaller, all the required tricks to make external packages work are already integrated within PyInstaller itself so that there is no user intervention required. You'll never be required to look for tricks in wikis and apply custom modification to your files or your setup scripts. As an example, libraries like PyQt, Django or matplotlib are fully supported, without having to handle plugins or external data files manually. Check our compatibility list of SupportedPackages.
我希望这有帮助,祝你好运,并告诉你是否需要更多帮助
关于python - 75 MB Helloworld 与 py2app !,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6843156/