python - Pyinstaller 给出错误(“加载 Python 时出错......找不到合适的图像”)
问题描述
我在 Mac 上遇到了 pyinstaller 的问题,当我单击创建的可执行文件时会出现此错误:
[9888] Error loading Python lib '/Users/Faris/Downloads/as5/dist/startscreen/Python': dlopen: dlopen(/Users/Faris/Downloads/as5/dist/startscreen/Python, 10): no suitable image found. Did find:
/Users/Faris/Downloads/as5/dist/startscreen/Python: code signature invalid for '/Users/Faris/Downloads/as5/dist/startscreen/Python'
这是一个使用 PIL 和 4 个 PNG 文件的 GUI 应用程序。我怎样才能解决这个问题?
解决方案
我找到了如何让它工作。在 Python 库位于您的 dist 文件夹后,运行:
codesign -f -s - Python
然后运行应用程序。
我有一个理论问题是什么,但我不确定。我认为 Python lib 已签名,但是当 PyInstaller 将其从原来的位置移动时,签名验证失败。
该命令的作用是将签名替换为ad-hoc签名,这允许您在本地运行应用程序,但可能不算作分发的签名。我不能说我完全理解它。
在发布应用程序之前,您可能希望将临时签名替换为适当的签名。
推荐阅读
- xamarin.forms - 在发布模式 xamarin 上具有退出代码 1 的 Java.exe
- python - Python:Django TypeError:object()不带参数
- python - 以与 Jupyter Notebook 相同的样式将 pandas 数据框呈现为 HTML
- python - 405 客户端错误:url 不允许使用方法:https://rinkeby.infura.io PYTHON
- node.js - 为什么查询不起作用的 FireStore?
- java - 递归嵌套目录中的多线程,同时删除它
- java - 如何使用 JOOQ Query Builder 使用使用常量值的 select 语句构建 Insert into
- postgresql - POSGTRESQL 9.10 - 从 JSON 数组返回最大值
- java - 通过本地 java 应用程序执行 html 按钮的任务
- reactjs - 来自道具的背景图像不适用于样式化组件