zoukankan      html  css  js  c++  java
  • 【Python】pyinstaller打包运行报错failed to execute script main

    前言

    最近用pyinstaller打包的时候一直报“failed to execute script main”。
    最终使用“pyinstaller --hidden-import=pkg_resources -F main.py” 顺利打包。
    注意:语句中的“-F”一定要大写

    转载原文

    本文转载自pyinstaller打包运行报错failed to execute script main

    pyqt5写完win32 应用程序后,经过pyinstaller打包成单个文件,运行弹出错误提示框:failed to execute script main
    pycharm中pyinstaller打包参数:
    Program:C:PythonPython35Scriptspyinstaller.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

  • 相关阅读:
    面向对象思想
    jQuery随笔
    总结关于linux操作
    转.linux上安装python
    sql server 基本语句
    linux 常见指令
    loadrunner 录制时不自动弹出网页
    Linux 安装MySQL
    linux关于安装
    loadrunner 性能测试
  • 原文地址:https://www.cnblogs.com/NBDWDYS2214143926/p/12190934.html
Copyright © 2011-2022 走看看