1

On Win10 64bit I installed PyQt5_5.4.1 for Python3.4.3. I need 3.4.3 for supporting XP clients and this is the last version that can be installed on XP. PyQt5 installed itself in python3.4.3 folder C:\Python34 and I can see it in PATH C:\Python34\Lib\site-packages\PyQt5

When I run my script with python myscript.py everything is fine, the gui window shows. However, when I try to run an .exe file from that script created with pyinstaller like this pyinstaller myscript.py --onefile I get an error:

Qt: Untested Windows version 10.0 detected!
This application failed to start because it 
could not find or load the Qt platform plugin "windows".

Reinstalling the application may fix this problem.

This code I have in myscript.py:

from PyQt5 import QtWidgets, QtCore, QtGui

Is there a fix for this problem? I tried reinstaling PyQt5 but no luck.

Hrvoje T
  • 1,959

1 Answers1

0

Make a hook file in your project directory. Name it hook-PyQt5.py for example:

from PyInstaller.utils.hooks import qt_plugins_binaries
# Fixed the issue: could not find or load the Qt platform plugin "windows".
binaries = qt_plugins_binaries('platforms', 'PyQt5')

In the Pyinstaller spec file, add a parameter

hookspath=['./']

to Analysis object:

a = Analysis(
    ...
    hookspath=['./'],
    ...
)

or specifiy an argument "--additional-hooks-dir" to commandline if you use PyInstaller directly.

python -m PyInstaller --additional-hooks-dir="./" <your-script>
Jruv
  • 101