python py2app 帮助

0 投票
2 回答
1847 浏览
提问于 2025-04-16 22:56

我试着用py2app,但我搞不清楚我想要制作独立应用的文件名应该放在哪里。我需要运行什么命令呢?我现在非常困惑……

2 个回答

4

在你的 setup.py 文件中,你想要做一些类似这样的事情:

from distutils.core import setup
import py2app

setup(name="App name",
      version="App version",
      options=opts, # see the py2app docs, could be a lot of things
      app=[main.py], # This is the standalone script
     )
1

请查看文档 - 你需要把你的文件名传给py2applet脚本。

$ py2applet --make-setup MyApplication.py
Wrote setup.py
$ python setup.py py2app -A

在我看来,pyInstaller是制作Python程序可执行文件的最佳工具。

撰写回答