Python PyInstaller打包后报错'ModuleNotFoundError: No module named 'webencodings''解决方法
使用PyInstaller打包Python程序后,执行exe文件时,如果出现'ModuleNotFoundError: No module named 'webencodings''错误,即使您已经安装了'html5lib'和'webencodings',可能是因为PyInstaller在打包时没有包含这些依赖项。
解决方法是在打包时指定依赖项,例如:
pyinstaller --hidden-import=webencodings --hidden-import=html5lib your_script.py
其中,'--hidden-import'参数可以指定需要隐藏的依赖项,这样在打包时就会将这些依赖项打包进去。
通过指定依赖项,PyInstaller就能将所有必要的库打包到最终的exe文件中,从而避免执行时出现模块找不到的错误。
原文地址: https://www.cveoy.top/t/topic/f9wo 著作权归作者所有。请勿转载和采集!