'win32ctypes.pywin32.pywintypes.error: (87,'UpdateResource','参数不正确')'使用 pyinstaller 分配图标时出错

发布于 2025-01-12 18:25:02 字数 617 浏览 3 评论 0原文

将图标附加到它

pyinstaller.exe --onefile --windowed --icon="test.ico" test.py

我正在使用 pyinstaller.py 文件类型创建可执行文件,并使用命令'.ico' 500 像素 x 500 像素24 位深度,使用 Photoshop 创建并导出为 '.bmp',然后手动导出改为'.ico' 在分配给文件夹时工作正常,但在尝试将其分配给 pyinstaller 可执行文件 时,我不断收到错误:

raise error(exception.winerror, exception.function, exception.strerror)
win32ctypes.pywin32.pywintypes.error: (87, 'UpdateResource', 'The parameter is incorrect')

如何解决此问题?

I am using pyinstaller to create an executable from a .py file type and attaching an icon to it using the command

pyinstaller.exe --onefile --windowed --icon="test.ico" test.py

The '.ico' is 500px by 500px and 24bit depth and was created with Photoshop and exported as a '.bmp' and then manually changed to a '.ico' and worked fine when assigned to a folder but when trying to assign it to the pyinstaller executable I keep getting the error:

raise error(exception.winerror, exception.function, exception.strerror)
win32ctypes.pywin32.pywintypes.error: (87, 'UpdateResource', 'The parameter is incorrect')

How to fix this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

流星番茄 2025-01-19 18:25:02

经过进一步调查,似乎图标文件未正确生成。
如果有人遇到此问题,请使用:icoconverter.com 正确转换您的图像

After further investigation it appears that the icon file was not generated correctly.
If anyone is having this issue use: icoconverter.com to convert your image properly

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文