前言

最近用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. ajax异步的加深理解

    过去印象中的ajax的异步操作,一直还居然在$.ajax函数内部的异步,真是大错特错,实际的异步操作,是针对整个js文件来的. 今天总算意识到了,实际情况如下: $(function(){ //[弹框 ...

  2. iOS数据锁

    简介 当一个线程访问数据时,而其他数据不能进行访问,保证线程安全或者可以理解为执行多线程,对于共享资源访问时保证互斥的要求 文章 不再安全的 OSSpinLock iOS开发中的11种锁以及性能对比 ...

  3. Linux查看后台任务,关闭后台任务

    jobs查看后台任务, kill %num关闭相应的后台任务

  4. 翻转链表和k个一组翻转以及两两反转

    一.输入一个链表,输出反转后的链表. 非递归实现: # -*- coding:utf-8 -*- # class ListNode: # def __init__(self, x): # self.v ...

  5. SpringMVC学习笔记四:SimpleMappingExceptionResolver异常处理

    SpringMVC的异常处理,SimpleMappingExceptionResolver只能简单的处理异常 当发生异常的时候,根据发生的异常类型跳转到指定的页面来显示异常信息 ExceptionCo ...

  6. Junit 单元测试在 intelliJ IDEA 中的安装

    1.为什么使用Junit我们都知道,main 方法是一个程序的入口,通常来说,没有main方法,程序就无法运行.我们经常会写一些class文件(如下图所示),他们并没有自己的main方法.那么我们如何 ...

  7. 「CometOJ」Contest #11

    Link Aeon 显然字典序最大就是把最小的字母放在最后 Business [动态规划] 简单dp dp[i][j]dp[i][j]dp[i][j]表示到第iii天,当前有jjj块钱,最后返还的钱最 ...

  8. (二)一个很好用的自动生成工具——mybatis generator

    mybatis generator-自动生成代码 准备材料: 一个文件夹,一个数据库的驱动包,mybatis-generator-core-1.3.5.jar,一条生成语句 如图:(我用的是derby ...

  9. Numpy入门(二):Numpy数组索引切片和运算

    在Numpy中建立了数组或者矩阵后,需要访问数组里的成员,改变元素,并对数组进行切分和计算. 索引和切片 Numpy数组的访问模式和python中的list相似,在多维的数组中使用, 进行区分: 在p ...

  10. gitlab配置邮箱

    邮件测试Notify.test_email('xx@qq.com', 'Message Subject', 'Message Body').deliver_now 参考 https://www.cen ...