我正在学习Qt和PyQt,我认为它们很有用。我试图使用PyQt6通过VSCode制作一个标记编辑器,但是解释器说:
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.但是为什么呢?当我在中运行C++ Qt项目时,它甚至没有任何警告,但是当我运行一个PyQt项目时,它是错误的。因为编辑?但即使在Qt创建者中也是错误的!
代码:
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_())环境: WIndows 11 (64位),Python3.10.3,Visual代码,Qt 6,PyQt 5。
发布于 2022-09-12 00:12:11
PyQt6与您的计算机不兼容,所以我建议您卸载它并使用您的pip安装PyQt5。因此,在命令行接口上键入以下内容:
py -m pip unintall pyqt6
py -m pip install pyqt5https://stackoverflow.com/questions/71611483
复制相似问题