2

I have a fully working PyQt5 project, now trying to make a standalone executable that is preferably OS independent.

I am using PyInstaller-3.2 in ubuntu 14.04 for this purpose. Tried the following command.

pyinstaller --additional-hooks-dir=. -F <file-path>    

Everything works, but when I have run the particular executable, received the following ImportError:

ImportError: No module named PyQt5

Later, I have found out that I need to include some PyInstaller hooks to import PyQt5

As my related imports throughout the project were:

from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5 import QtWidgets, uic
from PyQt5.QtCore import QThread

So, I have added some hooks namely hook-PyQt5.QtCore.py, hook-PyQt5.QtGui.py, hook-PyQt5.QtWidgets.py, hook-PyQt5.uic.py which content is more or less like below:

hiddenimports = ["PyQt5.QtCore.*"]

Then I run the PyInstaller command.

pyinstaller --additional-hooks-dir=. -F <file-path>

But, unfortunately, I got the same importError.

What I am doing wrong here?

Ahsanul Haque
  • 10,676
  • 4
  • 41
  • 57

0 Answers0