PyInstaller; “could not find or load the Qt platform plugin ”windows"

后端 未结 4 856
轮回少年
轮回少年 2021-02-06 00:31

My PyInstaller spec:

# -*- mode: python -*-

block_cipher = None


a = Analysis([\'test.py\'],
             pathex=[\'C:\\\\Users\\\\admin\\\\compile\'],
                


        
4条回答
  •  栀梦
    栀梦 (楼主)
    2021-02-06 01:21

    I had an issue where my python code worked fine, but the compiled .exe file would provide the "could not find or load the Qt platform plugin windows" problem. I fixed the problem by copying the ~PyQt5\Qt\plugins\platforms folder from the program's directory, generated by using pyinstaller --onedir main.py, to the folder holding the .exe file.

    It seems that in my case the only way "helping" my program detect the required .dlls was having the platforms folder next to the main.exe. Pasting the platforms folder to the program's directory after using pyinstaller --onefile main.py also makes the program work.

提交回复
热议问题