Tag Archives: Pit encountered by pyqt5

How to Solve pyqt5 imports module Error

Pyqt5 reports an error when importing the module:

1

ImportError: DLL load failed: Cannot find the specified program

2

ImportError: DLL load failed: Cannot find the specified program

3

ImportError: cannot import name 'QtCore'

The reason for the above error: the versions of pyqt5, pyqt5 SIP and pyqt5 stub modules are not interconnected

The solution is as follows:

    1. Open Win + R for operation, enter CMD to enter the terminal window, and enter it successively in the command line
pip uninstall PyQt5
pip uninstall PyQt5-sip
pip uninstall PyQt5-stubs

And the modules related to pyqt5 (such as pyqt5#u tools) are unloaded, and then input

pip install PyQt5

In this way, the installation already includes the corresponding versions of pyqt5 SIP and pyqt5 stubs. There is no need to install again, and then reinstall the modules related to pyqt5 (just uninstalled), such as PIP install pyqt5_tools

This will run successfully!