My PyInstaller spec:
# -*- mode: python -*-
block_cipher = None
a = Analysis(['test.py'],
pathex=['C:\\Users\\admin\\compile'],
binaries=[('C:\\Python361\\Lib\\site-packages\\PyQt5\\Qt\\plugins\\platforms\\qwindows.dll', 'qwindows.dll')],
datas=[],
hiddenimports=[],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
name='test',
debug=False,
strip=False,
upx=False,
runtime_tmpdir=None,
console=False , icon='icon.ico')
So I have ran into the problem where I will compile my PyQt5 5.8.2 (with Python 3.6.1) program with the latest version of PyInstaller from pip, and it works! The statically linked, onefile executable works on my computer with all the Qt stuff on it.
But then I test it on any computer or virtual machine that doesn't have the Qt environment set up already, and it crashes on start because of the "could not find or load the Qt platform plugin 'windows'" error. If you look at the spec you'll notice that I attempted to store the DLL in the binary list manually so PyInstaller would store it in the executable, but that didn't work.
I would like to know what I need to change so that I can compile my application without having to do something like include the platforms folder in the folder with the executable (I want everything to be in the executable), would it be as simple as a change in the spec file that I didn't realize so that it stores the DLL in the executable?
By the way, this is not a duplicate. I looked at some of the other questions and all of them were either for a different type of application or the solution was to downgrade or store the DLL in the folder and I can't do either of those.
EDIT: So I changed it to onedir just to see if it was even in there, and qwindows.dll is inside of the folder. There is also a qt5_plugins folder which has a platforms folder which also has a qwindows.dll. So how is it not detecting the dll??