ImportError: DLL load failed while importing QtWidgets: 找不到指定的程序。

ImportError: DLL load failed while importing QtWidgets: 找不到指定的程序。
报错:在这里插入图片描述
from PyQt5 import QtWidgets
ImportError: DLL load failed: 找不到指定的程序

解决方法,以管理员身份运行,
1、卸载重装。
pip install PyQt5
或者
conda install PyQt5
2、
在尝试解决方案1无效的情况下,发现问题所在是当前的虚拟环境缺少python3.dll文件,但是之前的笔记本并没有这个文件,工程仍然可以运行。安装了Python的依赖,可能导致系统环境在运行时出现错误。

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

普通命令下的python导入库文件,没有报错,OK。
退出exit(),切换环境然后就可以通过jupyter开始你的旅程-编写一个空白窗口.然后就没有问题啦。
代码

import sys

from PyQt5.QtWidgets import QApplication, QWidget

if __name__ == '__main__':

    app = QApplication(sys.argv)

    w = QWidget()

    w.resize(250, 150)

    w.move(300, 300)

    w.setWindowTitle('Simple')

    w.show()

    sys.exit(app.exec_())

在这里插入图片描述

  • 2
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 4
    评论
回答: ImportError: DLL load failed while importing QtWidgets: 不到指定的模块是由于缺少QtWidgets模块导致的。根据引用\[1\]中的情况,可能是由于pyinstaller打包时的版本问题导致的。你可以尝试降低pyinstaller的版本到5.1,使用命令pip install pyinstaller==5.1进行安装,然后重新打包。这样可能会解决该问题。另外,根据引用\[2\]和引用\[3\]的情况,如果你在IDE中运行时出现不到模块的错误,可以检查一下你的环境搭建是否正确,是否安装了正确版本的PyQt5,并且确保你的环境变量中包含了必要的dll文件。如果还是无法解决问题,你可以尝试重新安装Anaconda,并确保环境配置正确。希望这些方法能够帮助你解决问题。 #### 引用[.reference_title] - *1* [pyinstaller打包后出现ImportError: DLL load failed while importing QtWebEngineWidgets: 不到指定的...](https://blog.csdn.net/weixin_46570773/article/details/128407302)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* [PyQt5ImportError: DLL load failed while importing QtWidgets: 不到指定的模块。](https://blog.csdn.net/qq_26850561/article/details/122739983)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item] - *3* [【问题解决】ImportError: DLL load failed while importing QtXXX: 不到指定程序的一种可能性](https://blog.csdn.net/smylovers/article/details/128316742)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

海宝7号

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值