如何从Python程序制作EXE文件?

时间:2020-03-05 18:49:09  来源:igfitidea点击:

我已经使用了几个模块来制作适用于Python的EXE,但是我不确定自己是否做对了。

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

解决方案

回答

py2exe:

py2exe is a Python Distutils extension which converts Python scripts into executable Windows programs, able to run without requiring a Python installation.

回答

py2exe可能是我们想要的,但是它仅适用于Windows。
PyInstaller可在Windows和Linux上运行。
Py2app在Mac上可以使用。

回答

请参阅FreeHackers.org上的python打包工具的简短列表。

回答

我发现此演示文稿非常有帮助。

我如何在Windows py2exe和InnoSetup上分发Python应用程序

从站点:

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.

回答

gui2exe不在freehackers列表中,它可用于从Python脚本开始构建独立的Windows可执行文件,Linux应用程序和Mac OS应用程序捆绑包和插件。