首页 > Windows开发 > 详细

win7下正常运行,而在win10下出现错误告警

时间:2020-05-11 00:02:28      阅读:117      评论:0      收藏:0      [点我收藏+]

pyinstaller打包运行报错failed to execute script main

pyqt5写完win32 应用程序后,经过pyinstaller打包成单个文件,运行弹出错误提示框:failed to execute script main
pycharm中pyinstaller打包参数:
Program:C:\Python\Python35\Scripts\pyinstaller.exe
Parameters: -w -F $FileName$
Working directory: $FileDir$

分析:
经google,发现pyinstaller 有--hidden-import 选项
     --hidden-import MODULENAME, --hiddenimport MODULENAME
               Name an import not visible in the code of the
                script(s). This option can be used multiple times.

解决:
打包时加上 --hidden-import=queue
即Parameters配置修改为:
Parameters:--hidden-import=queue -w -F $FileName$
eg:
pyinstaller --hidden-import=queue -w -F main.py

在其他地方看到这种用法,正在验证中:pyinstaller --hidden-import=pkg_resources -F main.py

win7下正常运行,而在win10下出现错误告警

原文:https://www.cnblogs.com/huangyz-xy/p/12866017.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!