Skip to main content
 首页 » 编程设计

python之从 pyinstaller 构建的 mac os x 应用程序包无法正常工作

2025年05月04日9lvdongjie

我使用 PyInstaller 为我的 python2.7 包构建了一个 mac os x 应用程序包。双击应用程序图标会立即弹出控制台窗口,但会立即消失。但是,双击展开的“Contents/MacOS/executable”会正确弹出预期的窗口。

以下是我扩展的应用程序内容的屏幕截图。 Frameworks 文件夹是空的,Resources 文件夹包含图标,MacOS 文件夹包含所有二进制库和可执行文件(如上所述运行正常)。不确定修改 info.plist 是否有帮助。

请您参考如下方法:

您是否尝试过使用 -w 标志?来自文档:

-w, --windowed, --noconsole

Use a windowed subsystem executable, which on Windows does not open the console when the program is launched. This option is mandatory when creating .app bundle on Mac OS X.