首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >PyInstaller不更新ic

PyInstaller不更新ic
EN

Stack Overflow用户
提问于 2013-10-18 19:10:29
回答 1查看 401关注 0票数 0

PyInstaller错误地为用户定义了包含.icns的标志,但它实际上什么也不做,如文档所示:

代码语言:javascript
运行
复制
-i FILE.ICO, -i FILE.EXE,ID, -i FILE.ICNS, --icon=FILE.ICO, --icon=FILE.EXE,ID, --icon=FILE.ICNS
If FILE is an .ico file, add the icon to the final executable. Otherwise, the syntax 'file.exe,id' to extract the icon with the specified id from file.exe and add it to the final executable. If FILE is an .icns file, add the icon to the final .app bundle on Mac OS X (for Mac not yet implemented)

因此,这是相当无望的。下一个最好的方法当然是用我自己的图标替换默认的PyInstaller图标。我在一个脚本中做到了这一点:

代码语言:javascript
运行
复制
pyinstaller -y --windowed  --name="foobar" --workpath="target/build" --distpath="target/dist" *.spec

# Update the icon: PyInstaller's -i switch is not implemented for Mac
cp "path/to/icon.icns" "target/dist/foobar.app/Contents/Resources/icon-windowed.icns"

然而,我发现以编程方式这样做会使Finder感到困惑,因为它已经将应用程序注册为具有原始的Python图标。然而,它却找不到。因此,应用程序启动时根本没有图标。

如何正确设置图标?

EN

回答 1

Stack Overflow用户

发布于 2013-11-27 17:19:04

似乎pyinstaller的选项只与创建spec文件相关。拥有等级库文件后,应编辑等级库文件中的命令,而不是为命令行提供选项,这将被忽略。

要查看这些命令行选项在spec文件中的效果,可以使用随PyInstaller一起分发的pyi-makespec脚本。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/19448251

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档