前言

最近用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:\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

【Python】pyinstaller打包运行报错failed to execute script main的更多相关文章

  1. Pyinstaller 打包exe 报错 "failed to execute script XXX"的一种解决方案

    最近用PyQt5写了一个界面小程序,需要打包成exe给到其他windows上使用,一开始使用python 3.7 64位,用pyinstaller打包exe,在64位机上运行正常. 但是目标电脑是32 ...

  2. 【解决】MacOS下 Python3.7 使用 pyinstaller 打包后执行报错 Failed to execute script pyi_rth__tkinter

    Fix tcl/tk libs inclusion in tkinter with Python3.7 under MacOS 使用 Pyinstaller 打包时候报错 3027 ERROR: Tc ...

  3. python pyinstaller 打包程序报错解决

    python打包exe,各种入坑 一.安装PyInstaller 1.安装pywin32 pip命令安装:pip install pywin32(推荐) 2.安装Pyinstaller pip命令安装 ...

  4. python pyinstaller 打包exe报错

    今天用python 使用pyinstaller打包exe出现错误 环境pyqt5 + python3.6 在导入pyqt5包之前加上如下代码 import sysimport osif hasattr ...

  5. tomcat运行报错Failed to start component [StandardEngine[Catalina].StandardHost[localhost].

    tomcat运行报错Failed to start component [StandardEngine[Catalina].StandardHost[localhost].多半情况是找不到jar包 解 ...

  6. xhprof查看性能测试图一直报错:failed to execute cmd: " dot -Tpng"多种因素解决方案

    xhprof查看性能测试图一直报错:failed to execute cmd: ” dot -Tpng”多种因素解决方案最近在新环境进行php代码性能测试,用了xhprof这个工具,搭建好以后,点击 ...

  7. 安装maven工程报错"Failed to execute goal on project...Could not resolve dependencies for project..."

    我在qingcheng_interface中Lifecycle目录下执行install命令后报错"Failed to execute goal on project...Could not ...

  8. 【spring cloud】在spring cloud服务中,打包ms-core失败,报错Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.0.4.RELEASE:repackage (default) on project

    在spring cloud服务中,有一个ms-code项目,只为所有的微服务提供核心依赖和工具类,没有业务意义,作为核心依赖使用.所以没有main方法,没有启动类. 在spring cloud整体打包 ...

  9. IMPI Python集群运行报错:

    Intel MPI环境利用hostfile多主机运行下报错 HYDU_process_mfile_token (../../utils/args/args.c:523): token slots no ...

随机推荐

  1. 深入JVM内核--JVM简介

    JVM概念 jvm是指通过软件模拟的具有完整硬件系统功能的.运行在一个完全隔离环境中的完成计算机系统. 目前主要有vmMare.visual Box和JVM三款虚拟机. JVM使用软件模拟java字节 ...

  2. jQuery常用方法归纳总结

    转自:http://segmentfault.com/a/1190000000660257 $.grep() $.grep( array, function(elementOfArray, index ...

  3. MAYA 卸载工具,完美彻底卸载清除干净maya各种残留注册表和文件

    是不是遇到MAYA/CAD/3DSMAX/INVENTOR安装失败?AUTODESK系列软件着实令人头疼,MAYA/CAD/3DSMAX/INVENTOR安装失败之后不能完全卸载!!!(比如maya, ...

  4. 经典题型-打印小星星(python)

    # * # * * # * * * # * * * * # * * * * * x = 0 while x < 5: x += 1 # 每次循环需要给y赋值0.清空y中存储的值 y = 0 wh ...

  5. Pytorch collate_fn用法

    By default, Dataloader use collate_fn method to pack a series of images and target as tensors (first ...

  6. 使用wget获取其他服务器上的文件

    http://www.cnblogs.com/tankblog/p/6081521.html

  7. POJ 3041 Asteroids 二分图之最大匹配

    题意:在一个网格中有若干个点,每一次可以清除一行或者一列,问最少几次可以将网格中的点全部清除. 思路:这个题是一个入门的最大匹配题(这个好像不是思路..).一般的方式就是将 行 看作集合A,列 看作集 ...

  8. DEBUG -- CLOSE BY CLIENT STACK TRACE问题的两种解决方案,整理自网络

    1.DEBUG -- CLOSE BY CLIENT STACK TRACE 最近用c3p0遇到各种奇怪的问题,也不知道是它不行还是我不行. 今天又遇到了一个"DEBUG -- CLOSE ...

  9. python自动化工具

    公司有些业务不断的重复复制和黏贴实在让人头疼,于是乎考虑使用python自动的生成文件,并且替换文件中的一些内容,把需要复制和黏贴的内容制作成 模版,以后的开发工作可以根据模版来自动生成文件,自己以后 ...

  10. 阿里云Confluence无法发送邮件修复

    阿里云屏蔽外网的25端口,防止发送垃圾邮件,所以导致阿里云上的ecs无法发送邮箱 采用腾讯邮箱,端口25和465都试了好几遍,最终改成587即可 参考https://blog.csdn.net/qq_ ...