问题

使用pyinstaller打包exe程序后,出现如下错误:Failed to execute script ‘pyi_rth_win32comgenpy’ due to unhandled exception!

Traceback (most recent call last):File "Lib\site-packages\PyInstaller\hooks\rthooks\pyi_rth_win32comgenpy.py", line 40, in <module>File "PyInstaller\loader\pyimod02_importers.py", line 499, in exec_moduleFile "win32com\__init__.py", line 5, in <module>
ImportError: DLL load failed while importing win32api: 找不到指定的程序。
[4340] Failed to execute script 'pyi_rth_win32comgenpy' due to unhandled exception!

其中,使用的部分第三方库版本:

pyinstaller:5.7.0
pywin32:305

分析过程

同时也把同样脚本发给同事尝试打包,同事打包后的程序居然可以运行!!
pip list查询第三方库版本,我们都是一致的,除了conda库版本,由于我们都是用conda虚拟环境打包的。【同事电脑的conda是4.11.0,我电脑的是22.9.0】

通过报错提示,只能往pyinstaller和pywin32库版本不兼容这个方向解决问题或者升级conda库。

解决方法

  • 方法1:卸载conda环境的pywin32库,经过尝试,发现安装228版本的可行。
pip uninstall pywin32
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pywin32==228
  • 方法2:升级conda库为最新版本(当前最新版本为22.11.1)
以管理员身份启动 Anaconda Prompt:
conda update conda
conda update --all

亲测有效!python:Failed to execute script ‘pyi_rth_win32comgenpy‘ due to unhandled exception!相关推荐

  1. pyinstall Failed to execute script ‘main‘ due to unhandled exception: [WinError 3]系统找不到指定的路径,包含文件夹

    问题 Failed to execute script 'main' due to unhandled exception: [WinError 3]系统找不到指定的路径 打包文件 包含文件夹 YOL ...

  2. pyinstaller打包报错 Failed to execute script ‘xxx‘ due to unhandled exception:input():lost sys.stdin

    pyinstaller打包报错 Failed to execute script 'xxx' due to unhandled exception:input():lost sys.stdin pyi ...

  3. 【Python】Pyinstaller打包路径配置(Failed to execute script ‘app‘ due to unhandled exception已解决)

    一.说明 关于Pyinstaller,可以查看Python打包发布1(基于Pyinstaller打包多目录项目) Pyinstaller可以将资源文件一起打包到exe中,当exe在运行时,会生成一个临 ...

  4. Failed to execute script ‘xxx‘ due to unhandled exception:No module named ‘ctypes‘

    解决: 添加 --hidden-import 参数 pyinstaller -Fw -i .\pdf.ico --hidden-import=ctypes --hidden-import=psutil ...

  5. python gui打包exe pyinstaller打包运行失败 Failed to execute script pyi_rth_multiprocessing

    python 通过pyinstaller打包后,在别的电脑运行失败 Failed to execute script pyi_rth_multiprocessing 在低版本windows7上运行会出 ...

  6. pyinstaller 打包python应用为exe后 打包出现failed to execute script

    pyinstaller 打包python应用为exe后 打包出现failed to execute script 打包后出现如题问题,只需在打包语句中加入pkg_resources.py2_warn这 ...

  7. Python打包exe后报错:Failed to execute script xxxx问题的解决办法

    本篇文章主要讲解,python 通过 pyinstaller 打包python脚本后输出exe,执行时报错 Failed to execute script[脚本无法执行的错误]解决办法 日期:202 ...

  8. python fail to execute,pyinstaller 打包出现“Failed to execute script XXX“问题

    pyinstaller 打包PyQt5的 *.exe 程序出现"Failed to execute script XXX"问题 由于本人刚接触python,偶然看到用PyQt5做窗 ...

  9. python failed to execute_PyQt5 Pyinstaller 打包 exe 提示 failed to execute script

    系统环境为:win7 32 位虚拟机 python 3.5.2 pyinstaller 3.3.1 PyQt5.9 python 文件在未打包时可运行 但是-w 打包后提示: failed to ex ...

最新文章

  1. Windows7操作系统自定义运行命令(简单方法之二)
  2. Servlet组件之一——Filter过滤器
  3. HttpSecurity初步理解
  4. 总结获取原生JS(javascript)的父节点、子节点、兄弟节点
  5. centos7全离线安装docker1.17.12
  6. CASE_04 基于FPGA的电梯控制器
  7. 在Win10删除Ubuntu时直接删除分区后,如何删除启动项(EFI)
  8. 人脸识别研究任务及开源项目调研
  9. 计算机考试400,400作文:电脑考试
  10. 【codevs3147】矩阵乘法2,”名“不副”实“
  11. onSaveInstanceState() 和 onRestoreInstanceState()
  12. Mysql查询某字段值重复的数据个数
  13. CodeVs天梯白银Silver题解
  14. 1.PHP数据库陷阱
  15. CSDN账号被盗了吗?
  16. 智慧工地工人实名制管理整体解决方案
  17. 深入浅出java并发编程(线程池)
  18. Hadoop生态圈:19个让大象飞起来的工具!
  19. C语言(11),用程序写简单图形。
  20. 再次上演兄弟相煎,vivo再次超越OPPO在国内手机市场称王

热门文章

  1. win10玩cf不能全屏_5千左右预算,2020年畅玩吃鸡、魔兽、LOL、CF、炉石传说、逆水寒,高性价台式电脑推荐/选购指南...
  2. 电脑磁盘里总有个“.Trash-1000”,$recycle.bin文件夹删不掉,好像是装ubuntu双系统留下的。请问怎样删除?
  3. WC2015 酱油记
  4. slot-scope用法及理解
  5. Android动画特效之自定义View
  6. 使用JSP代码编写index.jsp文件在网页上显示数据库数据
  7. Word2010如何从正文开始设置页眉页码?
  8. 解密日内回转交易的优点和缺点
  9. 学堂在线疾风计划程序设计基础第1-4章
  10. php中单引号,php中的单引号、双引号和转义字符详解