1

I'm learning Qt and PyQt, and I think they're useful. I'm trying to use PyQt6 to make a Markdown Editor by VSCode, but the interpreter says:

qt.qpa.plugin: Could not find the Qt platform plugin "windows" in ""
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

But why? When I run a C++ Qt project in Qt Creator, it even has no warning, but when I run a PyQt project, it's error. Because of the editor? But it's error even in Qt Creater!

Code:

import sys
from PyQt6.QtWidgets import QApplication, QWidget

if __name__ == '__main__':
    scr = QApplication(sys.argv)
    w = QWidget()
    w.resize(200, 150)
    w.move(300, 300)
    w.setWindowTitle("My first PyQt5 Project")
    w.show()
    sys.exit(scr.exec_())

P.S. Enviroment: WIndows 11 (64-bit), Python 3.10.3, Visual Studio Code, Qt 6, PyQt 5.

  • Could you have a look at [this](https://stackoverflow.com/questions/41994485/how-to-fix-could-not-find-or-load-the-qt-platform-plugin-windows-while-using-m) page? – Steven-MSFT Mar 25 '22 at 05:47

1 Answers1

-1

PyQt6 is not compatible with your machine so I would rather suggest you uninstall it and install PyQt5 using your pip. So type this on your command line interface:

    py -m pip unintall pyqt6
    py -m pip install pyqt5