当时使用pyinstaller对python应用程序进行打包的,执行成功打包的exe应用程序时弹出一个错误提示框。信息如下:

Failed to execute script pyi_rth_pkgres

或者是其他的模块无法加载。此时可以使用打包时导入模块的方式

--hidden-import=pkg_resources.py2_warn

下面有个打包多个文件的示例

pyinstaller.exe -F -w .\photo_editor.py(主文件) -p .\color_filter.py -p .\img_helper.py --hidden-import PIL   --hidden-import=pkg_resources.py2_warn
Logo

一站式 AI 云服务平台

更多推荐