How do you fix this error: "ImportError: DLL load failed: The specified module could not be found." using PyQt5

How do you fix this error: "ImportError: DLL load failed: The specified module could not be found." using PyQt5

我目前正在使用 Python 3.6.8 和 PyQt5。我的程序运行良好,但在 Windows 更新后,一切都停止了。

这里是错误:

Traceback (most recent call last):
  File "main.py", line 10, in <module>
    from PyQt5 import QtWidgets, QtCore, QtGui
ImportError: DLL load failed: The specified module could not be found.

看起来环境变量在更新后已损坏。在最简单的情况下,它应该只是

添加 python 的 DLL 位置,例如

(C:\Program Files\Python35\DLLs)

path中的环境变量。您还可以看到其他一些possible solutions here

我通过 运行 命令提示符下的以下命令修复了这个错误:

pip install pyqt5-tools