python pyinstaller 打包exe报错
今天用python 使用pyinstaller打包exe出现错误

环境pyqt5 + python3.6 32位
在导入pyqt5包之前加上如下代码
import sys
import os
if hasattr(sys, 'frozen'):
os.environ['PATH'] = sys._MEIPASS + ";" + os.environ['PATH'] from PyQt5.QtWidgets import QApplication, QMainWindow
from pyqt_ui.MainWindow import MainWin if __name__ == '__main__':
app = QApplication(sys.argv)
mainWindow = QMainWindow()
main_dialog = MainWin(mainWindow)
mainWindow.show()
sys.exit(app.exec_())
运行
pyinstaller -F main2.py
96 INFO: PyInstaller: 3.5
97 INFO: Python: 3.6.4
97 INFO: Platform: Windows-7-6.1.7601-SP1
98 INFO: wrote E:\workspace\devTest\main2.spec
100 INFO: UPX is not available.
101 INFO: Extending PYTHONPATH with paths
['E:\\workspace\\devTest', 'E:\\workspace\\devTest']
101 INFO: checking Analysis
104 INFO: Building because E:\workspace\devTest\main2.py changed
104 INFO: Initializing module dependency graph...
107 INFO: Initializing module graph hooks...
109 INFO: Analyzing base_library.zip ...
4264 INFO: running Analysis Analysis-00.toc
4291 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
required by d:\mytool\env\env36-32\scripts\python.exe
4632 INFO: Caching module hooks...
4642 INFO: Analyzing E:\workspace\devTest\main2.py
4771 INFO: Processing pre-find module path hook distutils
4772 INFO: distutils: retargeting to non-venv dir 'C:\\Program Files (x86)\\Python36-32\\Lib\\distutils\\__init__.py'
4773 INFO: Processing pre-safe import module hook win32com
5572 INFO: Loading module hooks...
5572 INFO: Loading module hook "hook-encodings.py"...
5669 INFO: Loading module hook "hook-pydoc.py"...
5670 INFO: Loading module hook "hook-PyQt5.py"...
5804 WARNING: Hidden import "sip" not found!
5805 INFO: Loading module hook "hook-PyQt5.QtCore.py"...
5900 INFO: Loading module hook "hook-PyQt5.QtGui.py"...
6088 INFO: Loading module hook "hook-PyQt5.QtWidgets.py"...
6463 INFO: Loading module hook "hook-pythoncom.py"...
6855 INFO: Loading module hook "hook-pywintypes.py"...
7235 INFO: Loading module hook "hook-win32com.py"...
7320 INFO: Loading module hook "hook-xml.py"...
7666 INFO: Looking for ctypes DLLs
7667 INFO: Analyzing run-time hooks ...
7670 INFO: Including run-time hook 'pyi_rth_pyqt5.py'
7672 INFO: Including run-time hook 'pyi_rth_win32comgenpy.py'
7679 INFO: Looking for dynamic libraries
8747 INFO: Looking for eggs
8747 INFO: Using Python library d:\mytool\env\env36-32\scripts\python36.dll
8747 INFO: Found binding redirects:
[]
8752 INFO: Warnings written to E:\workspace\devTest\build\main2\warn-main2.txt
8822 INFO: Graph cross-reference written to E:\workspace\devTest\build\main2\xref-main2.html
8837 INFO: checking PYZ
8839 INFO: Building because toc changed
8839 INFO: Building PYZ (ZlibArchive) E:\workspace\devTest\build\main2\PYZ-00.pyz
9775 INFO: Building PYZ (ZlibArchive) E:\workspace\devTest\build\main2\PYZ-00.pyz completed successfully.
9788 INFO: checking PKG
9789 INFO: Building because toc changed
9790 INFO: Building PKG (CArchive) PKG-00.pkg
10019 WARNING: One binary added with two internal names.
10020 WARNING: ('libGLESv2.dll',
'D:\\mytool\\env\\env36-32\\lib\\site-packages\\PyQt5\\Qt\\bin\\libGLESv2.dll',
'BINARY')
10020 WARNING: was placed previously at
10021 WARNING: ('PyQt5\\Qt\\bin\\libGLESv2.dll',
'D:\\mytool\\env\\env36-32\\lib\\site-packages\\PyQt5\\Qt\\bin\\libGLESv2.dll',
'BINARY')
20621 INFO: Building PKG (CArchive) PKG-00.pkg completed successfully.
20628 INFO: Bootloader d:\mytool\env\env36-32\lib\site-packages\PyInstaller\bootloader\Windows-32bit\run.exe
20628 INFO: checking EXE
20631 INFO: Building because toc changed
20631 INFO: Building EXE from EXE-00.toc
20632 INFO: Appending archive to EXE E:\workspace\devTest\dist\main2.exe
20659 INFO: Building EXE from EXE-00.toc completed successfully.
打包成功
运行出现正常界面
注:为避免重复将main.py 更改为main2.py了
python pyinstaller 打包exe报错的更多相关文章
- Pyinstaller 打包exe 报错 "failed to execute script XXX"的一种解决方案
最近用PyQt5写了一个界面小程序,需要打包成exe给到其他windows上使用,一开始使用python 3.7 64位,用pyinstaller打包exe,在64位机上运行正常. 但是目标电脑是32 ...
- python pyinstaller 打包程序报错解决
python打包exe,各种入坑 一.安装PyInstaller 1.安装pywin32 pip命令安装:pip install pywin32(推荐) 2.安装Pyinstaller pip命令安装 ...
- 【Python】pyinstaller打包运行报错failed to execute script main
前言 最近用pyinstaller打包的时候一直报"failed to execute script main". 最终使用"pyinstaller --hidden-i ...
- Py打包exe报错
Py打包exe报错 下载地址 https://github.com/pyinstaller/pyinstaller 用管理员执行 pip install https:/ ...
- Python: pyinstaller打包exe(含file version信息)
最近项目上一直都是用Spyder直接运行.py文件的方式来执行每日的自动化程序,每天都要手动去点击Run来执行一次,所以考虑把.py文件直接打包成exe,然后用windows的task schedul ...
- python pyinstaller打包exe暗坑1
环境 python2.7.9 win-xp 今天打包了一个小脚本,结果打开报错
- 利用PyInstaller打包exe文件
前言 平常我们通过Python写完一些小脚本之后,如果使用不频繁的话,一般会选择在DOS界面直接跑脚本,或者在IDE中运行.但当我们需要频繁使用某些脚本,或者在没有Python环境的机器上也能顺利运行 ...
- 在Windows平台下Qt的exe报错问题排查步骤
在Windows平台下Qt的exe报错问题排查步骤 工具介绍: 1. Dependency Worker Dependency Worker是一个免费的用具用来扫描任何的32bit 或者64bit 的 ...
- python 读取配置文件总是报错 configparser.NoSectionError: No section:
本文为作者原创,禁止转载,违者必究法律责任!!! python 读取配置文件总是报错 configparser.NoSectionError: No section: 无论是 python2的版本,还 ...
随机推荐
- Hive窗口函数最全案例详解
语法: 分析函数 over(partition by 列名 order by 列名 rows between 开始位置 and 结束位置) 常用分析函数: 聚合类 avg().sum().max(). ...
- hbase、pig、hive配置与应用
------------------HBASE---------- [root@iClient~]#sudo yum install hbase #iClient安装Hbase客户端 [root@cM ...
- 深入理解 DeepSea 和 Salt 部署工具 - Storage6
学习 SUSE Storage 系列文章 (1)SUSE Storage6 实验环境搭建详细步骤 - Win10 + VMware WorkStation (2)SUSE Linux Enterpri ...
- nodeJs环境添加代理
目的:实现前后端分离,前端减少路径请求的所需的路由文件: 第一步:安装http代理中间件 npm install http-proxy-middleware --save 第二步: express文件 ...
- Docker系列(五):.Net Core实现k8s健康探测机制
k8s通过liveness来探测微服务的存活性,判断什么时候该重启容器实现自愈.比如访问 Web 服务器时显示 500 内部错误,可能是系统超载,也可能是资源死锁,此时 httpd 进程并没有异常退出 ...
- 手把手带你利用Ribbon实现客户端的负载均衡
之前的文章<SpringCloud搭建注册中心与服务注册>介绍了注册中心的搭建和服务的注册,本文将介绍下服务消费者通过Ribbon调用服务实现负载均衡的过程. 本文目录 一.Ribbon服 ...
- 未来实现API管理系统的几个关键词
下面将通过几个关键词的形式说明API管理的重要性和未来的实现方式. 1.生命周期管理 在整个API生命周期中更深入地集成所有工具将进一步提高生命周期循环的速度,而且更重要的是提供满足消费者需求的API ...
- vue-cli脚手架项目本地阅览和在线阅览
一.需求 开发环境:当然啦,前提是你要完整检测整个项目无错误的运行:npm run dev 后项目在本地预览问题没有问题 二.服务器本地阅览 生产环境:项目制作完成后需执行npm run build操 ...
- Java8新特性之空指针异常的克星Optional类
Java8新特性系列我们已经介绍了Stream.Lambda表达式.DateTime日期时间处理,最后以"NullPointerException" 的克星Optional类的讲解 ...
- .NET Core ❤ gRPC
这篇内容主要来自Microsoft .NET团队程序经理Sourabh Shirhatti的博客文章:https://grpc.io/blog/grpc-on-dotnetcore/, .NET Co ...