How do I convert my Python app to a .exe
? I made a program with tkinter
and was wondering how to make it possible for others to use. I use Python 3.3. I searched for a bit but could not find anything.
相关问题
- how to define constructor for Python's new Nam
- streaming md5sum of contents of a large remote tar
- How to get the background from multiple images by
- Evil ctypes hack in python
- Correctly parse PDF paragraphs with Python
Use Pyinstaller. After installing it, open terminal in the directory where your project resides.
$ pyinstaller script1.py script2.py ...
(where script1, script2, etc. are all the scripts used in your project.)After command is completed, open
dist
folder and enter the subdirectory. There you'll find an executable.Hope it helps.
cx_Freeze does this but creates a folder with lots of dependencies. py2exe now does this and, with the --bundle-files 0 option, creates just one EXE, which is probably the best solution to your question.
UPDATE: After encountering third-party modules that py2exe had trouble "finding", I've moved to pyinstaller as kotlet schabowy suggests below. Both have ample documentation and include .exes you can run with command line parameters, but I have yet to compile a script that pyinstaller isn't able to handle without debugging or head-scratching.
Here's a simple convenience function I use to build an .exe with my defaults from the interpreter (of course a batch or similar would be fine too):
I have found PyInstaller to work the best. You have many options for example you can pack everything to a one file exe.
I love to use it together with Cython for speed.
You can use cx_Freeze. There is a guide here.