PyQt5 - Failed to load platform plugin “windows”. Available platforms are: windows, minimal

前端 未结 8 1010
伪装坚强ぢ
伪装坚强ぢ 2020-12-06 02:27

When I try to run any PyQt5 program from Eclipse, I got this error.

Failed to load platform plugin \"windows\". Available platforms are: windows, mini

相关标签:
8条回答
  • 2020-12-06 03:12

    This is what worked for me while using the Anaconda Python 3.6 distribution:

    1. I installed PyQt5 using pip install pyqt5. What this does is it creates a Qt/Pluginsplugins directory in the ../Anaconda3/Lib/site-packages/PyQt5 path.

    2. Following Roger Allen and uetoyo, I added:

    if os.name == "nt":  # if windows
        from PyQt5 import __file__
        pyqt_plugins = os.path.join(os.path.dirname(__file__), "Qt", "plugins")
        QApplication.addLibraryPath(pyqt_plugins)
        os.environ['QT_QPA_PLATFORM_PLUGIN_PATH'] = pyqt_plugins
    

    to my script. It works with pyinstaller as well.

    0 讨论(0)
  • 2020-12-06 03:15

    Copy C:\Python34\Lib\site-packages\PyQt5\libEGL.dll to the same directory as your .exe.

    Source: http://bird1110.blogspot.com/2014/04/python-33-pyqt5-and-cxfreeze-exe-on-64.html

    0 讨论(0)
提交回复
热议问题