我正在尝试使用 PyInstaller 将 python 脚本转换为 .exe。 该脚本被转换为 exe,没有任何错误日志。
但是,在运行 .exe 文件时,出现ModuleNotFoundError:没有名为“srsly.msgpack.util”的模块
打开 PyInstaller 和 cx_Freeze 生成的 exe 文件时出现此问题。 The Screenshot of the error is attached here.
已尝试更新、卸载并重新安装软件包,但问题仍然存在。
版本:
- Python:3.7
- 操作系统:Windows 10
- cx_Freeze:6.0
- 消息包:0.6.2
- PyInstaller:3.5
- srsly:0.1.0
最佳答案
当 PyInstaller 评估您的脚本时,它没有预测对 srsly.msgpack.util 的依赖关系。您可以使用 --hiddenimport
手动指定依赖项。
pyinstaller --hiddenimport srsly.msgpack.util your_script.py
您可能会发现解决这个问题只会揭示另一个问题。您可以根据需要添加任意数量的 --hiddenimport
提示。
关于python - 如何解决ModuleNotFoundError : No module named 'srsly.msgpack.util' in PyInstaller?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58167107/