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

前端 未结 8 1090
伪装坚强ぢ
伪装坚强ぢ 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 02:51

    I like uetoyo's answer, but Anaconda has moved the directory. This works for me Python 3.5.2 Anaconda 4.2.0 on Windows 7.

    import os
    if os.name == "nt":  # if windows
        import PyQt5
        pyqt_plugins = os.path.join(os.path.dirname(PyQt5.__file__),
                                    "..", "..", "..", "Library", "plugins")
        QApplication.addLibraryPath(pyqt_plugins)
    

提交回复
热议问题