美文网首页PYQT5学习与开发
PYQT5(九)pyinstaller打包运行报错failed

PYQT5(九)pyinstaller打包运行报错failed

作者: 弗兰克万岁 | 来源:发表于2018-11-16 12:51 被阅读188次

    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 -i test.ico main.py

    问题2:

    ImportError: No module named ‘queue‘  

    Failed to execute script final_exam2  

    然后自己手工导入queue模块,并没有报错。

    打包时加上 --hidden-import=queue

    在尝试重新打包并且使用--hidden-import queue 后,程序能够正常运行。

    原文:https://blog.csdn.net/jeff_/article/details/72907113

    版权声明:本文为博主原创文章,转载请附上博文链接!

    相关文章

      网友评论

        本文标题:PYQT5(九)pyinstaller打包运行报错failed

        本文链接:https://www.haomeiwen.com/subject/hvfmfqtx.html