How can I package my python application with exter

2020-07-26 07:26发布

问题:

I hope my title was clear. I'm using wxpython for making a GUI and I want it to be able to be opened, extracted, and have it work on all operating systems. I was able to include twill by finding a folder called twill inside the twill archive, which worked fine. However, I'm unable to figure out how to correctly package wxpython.

EDIT: I'm not using either. py2exe is only for windows, and bbfreeze doesn't seem to work on mac (so it's not cross platform)

回答1:

Unfortunately, there's just no one stop solution so that a single installable executable will work across all operating systems. The right solution is really to provide a different installer or executable for each OS; For windows, use py2exe, for mac, py2app is a good choice, and for linux you should just provide a tarball with a reasonable setup.py (that you will need for the first two, anyway).



回答2:

You should go with the recommendation of TokenMacGuy. But I preferrably would use a tool which is able to freeze the application for all OS instead of using different ones. cx_freeze is a good choice regarding these terms.

This is another fine alternative:

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.



回答3:

Have you tried http://cx-freeze.sourceforge.net/ ?