Skip to content

[Solved] PyInstaller unable to find Qt5Core.dll

Introduction

If we finished a program in Python, and we want to share it for our friends their computer have no Python (Maybe they won’t to install it.), we can use “PyInstaller” to convert our program to be a exe file.

All right! We will meet many problem of it. I meet an Error to test my “Go Board” program:

Traceback (most recent call last):
  File "xxxxxx\ui.py", line 4, in 
  File "c:\users\remib\.virtualenvs\xxxxxxx-w7udp1ct\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
    exec(bytecode, module.__dict__)
  File "site-packages\PyQt5\__init__.py", line 41, in 
  File "site-packages\PyQt5\__init__.py", line 33, in find_qt
ImportError: unable to find Qt5Core.dll on PATH
[12876] Failed to execute script Board_GUI

Board_GUI is my program, no matter I double clicked my execute file of my converting, there is only a black window, and it closed too soon.

Fortunately, senior reminded me to use cmd to open file. That’s great! I can see the error message of error. So I remind to everyone if you read this article, you can use the cmd!

And maybe you can find many solution on github and stackoverflow, this is one of the dicussion: https://github.com/pyinstaller/pyinstaller/issues/4293

I have the same error, maybe everyone can refer it.


Solution

First, if the error display “PyQt5.sip not found”, you can import sip in your code. It may be solved.

from PyQt5 import sip

Like this.

Of course, if you have an Error of “unable to find Qt5Core.dll”

Traceback (most recent call last):
  File "xxxxxx\ui.py", line 4, in 
  File "c:\users\remib\.virtualenvs\xxxxxxx-w7udp1ct\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
    exec(bytecode, module.__dict__)
  File "site-packages\PyQt5\__init__.py", line 41, in 
  File "site-packages\PyQt5\__init__.py", line 33, in find_qt
ImportError: unable to find Qt5Core.dll on PATH
[12876] Failed to execute script Board_GUI

You can go to “site-packages/PyQt5/__init__.py” and execute this script once. The first time I see, the double settings if double slash “//”, I change it to single slash “/” and I succeeded. (But this way is not used on my classmate’s computer.)

And I have a problem yet. Although I doesn’t have the last error, but if I use PyInstaller to convert my program I had a same error “unable to find Qt5Core.dll on PATH”.

Finally, I add “PyQt5/Qt/bin” in my Environmental variables and it worked! I remind you can try it.

And, if you want to learn PyQt5, maybe you can refer my notes: [PyQt5] Tutorial(1) Install PyQt5 and print “Hello World!”

Leave a ReplyCancel reply

Click to Copy
Exit mobile version