如何从Python程序生成EXE文件?

2024-04-25 23:23:08 发布

您现在位置:Python中文网/ 问答频道 /正文

我已经使用了几个模块来制作Python的exe,但是我不确定我做的是否正确。

我该怎么做,为什么?请根据您的个人经验回答,并在必要时提供参考。


Tags: 模块经验exe
3条回答

我觉得这个报告很有帮助。

How I Distribute Python applications on Windows - py2exe & InnoSetup

从站点:

There are many deployment options for Python code. I'll share what has worked well for me on Windows, packaging command line tools and services using py2exe and InnoSetup. I'll demonstrate a simple build script which creates windows binaries and an InnoSetup installer in one step. In addition, I'll go over common errors which come up when using py2exe and hints on troubleshooting them. This is a short talk, so there will be a follow-up Open Space session to share experience and help each other solve distribution problems.

也称为冻结二进制文件,但与真正编译器的输出不同-它们通过虚拟机(PVM)运行字节码。与编译的程序运行相同的程序,因为该程序与PVM一起编译。Py2exe可以冻结使用tkinter、PMW、wxPython和PyGTK GUI库的独立程序;使用pygame游戏编程工具包的程序;win32com客户端程序;等等。 无堆栈Python系统是一个标准的CPython实现变量,它不在C语言调用堆栈上保存状态。这使得Python更易于移植到小堆栈体系结构,提供了高效的多处理选项,并培养了新的编程结构,如协同路由。其他正在研究未来发展的系统:Pyrex正在研究Cython系统,Parrot项目,PyPy正在研究完全替换PVM,当然Python的创始人正在与Google合作,用Unladen Swallow项目使Python的运行速度比C快5倍。简而言之,py2exe是最简单的,Cython现在更有效,直到这些项目改进了Python虚拟机(PVM)的独立文件。

Auto PY to EXE-A.py to.exe转换器,使用Python中使用Eel和PyInstaller构建的简单图形界面。


py2exe可能是您想要的,但它只适用于Windows。
PyInstaller适用于Windows和Linux。
Py2app适用于Mac。

相关问题 更多 >