简体   繁体   English

使用 pyinstaller 时出现 loguru ModuleNotFoundError

[英]loguru ModuleNotFoundError when using pyinstaller

when building EXE with pyinstaller, the resulting exe file doesn't execute and the error 'ModuleNotFoundError: No module named 'loguru'' is shown.使用 pyinstaller 构建 EXE 时,生成的 exe 文件不执行,并显示错误“ModuleNotFoundError: No module named 'loguru'”。 Running the pythons script works without any issues.运行 pythons 脚本没有任何问题。

didn't find any solution that worked so far on Stackoverflow到目前为止在 Stackoverflow 上没有找到任何有效的解决方案

The simpler solution is to use --hidden-import=loguru along with the PyInstaller script.更简单的解决方案是使用--hidden-import=loguru和 PyInstaller 脚本。 It will add modulename as import statement silently.它会默默地添加模块名作为导入语句。 Hooks are better if you want to specify which import needs what additional modules.如果您想指定哪个导入需要哪些附加模块,则挂钩会更好。 --hidden-import is simpler as a one-shot or for debugging. --hidden-import 作为一次性或调试更简单。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM