windows pyinstaller 安装时显示没有pythonxx.DLL/Pyinstaller:FormatMessageW failed/ xxx module 找不到
在使用pyinstaller打包时候可能显示出各种错误
1.windows pyinstaller 安装时显示没有pythonxx.DLL
2.Pyinstaller:FormatMessageW failed
3.module xxx 找不到
我来总结一下这些报错的可能解决方案
1.pythonxxx.DLL没有 解决方法:在网上下载对应的dll放到打包的根目录下
2.Pyinstaller:FormatMessageW failed 解决方法:同样的DLL可能有多种版本 挨个试 例如:python39.dll 免费下载 | DLL‑files.com (dll-files.com)
3.xxx module 找不到 解决方法:使用--hidden-import=xxx 例如:pyinstaller -D -w --add-data="./utils/*;./utils" --add-data="./config/*;./config" --add-data="./icon/*;./icon" --add-data="./pt/*;./pt" --add-data="./imgs/*;./imgs" main.py -F --hidden-import=pywt --hidden-import=pyimod02_importers
第三种方法运行程序会显示
416364 INFO: checking EXE 416374 INFO: Rebuilding EXE-00.toc because main.exe missing 416374 INFO: Building EXE from EXE-00.toc 416375 INFO: Copying bootloader EXE to C:\Users\86183\Downloads\PyQt5-YOLOv5-yolov5_v6.1\PyQt5-YOLOv5-yolov5_v6.1\dist\main.exe.notanexecutable 416410 INFO: Copying icon to EXE 416411 INFO: Copying icons from ['C:\\ProgramData\\Anaconda3\\envs\\yolo\\lib\\site-packages\\PyInstaller\\bootloader\\images\\icon-windowed.ico'] 416434 INFO: Writing RT_GROUP_ICON 0 resource with 104 bytes 416434 INFO: Writing RT_ICON 1 resource with 3752 bytes 416435 INFO: Writing RT_ICON 2 resource with 2216 bytes 416435 INFO: Writing RT_ICON 3 resource with 1384 bytes 416435 INFO: Writing RT_ICON 4 resource with 38188 bytes 416435 INFO: Writing RT_ICON 5 resource with 9640 bytes 416435 INFO: Writing RT_ICON 6 resource with 4264 bytes 416435 INFO: Writing RT_ICON 7 resource with 1128 bytes 416437 INFO: Copying 0 resources to EXE 416437 INFO: Embedding manifest in EXE 416438 INFO: Updating manifest in C:\Users\86183\Downloads\PyQt5-YOLOv5-yolov5_v6.1\PyQt5-YOLOv5-yolov5_v6.1\dist\main.exe.notanexecutable 416459 INFO: Updating resource type 24 name 1 language 0 416461 INFO: Appending PKG archive to EXE 420830 INFO: Fixing EXE headers 430471 INFO: Building EXE from EXE-00.toc completed successfully.
然后就可以了
4.其他可能的错误 python的版本和windows有关 所以请及时更换python对应windows 的版本
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通