在运行以下代码:
import sys
import MainWindowsHorizontalLayout
from PyQt5.QtWidgets import QApplication,QMainWindow
if name=='main':
app=QApplication(sys.argv)
mainWindow=QMainWindow()
ui=MainWindowsHorizontalLayout.Ui_MainWindow()
ui.setupUi()
mainWindow.show()
sys.exit(app.exec_())
发生错误,提示如下:
qt.qpa.plugin: Could not find the Qt platform plugin "cocoa" in ""
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
请问如何处理?
系统环境 macos 12.3 python 3.9 工具:pycharm 插件包:pyqt5 opencv-python-headless
ps:同步到windows可以正常运行
参看github上的问题讨论及解决思路,
https://github.com/miurahr/aqtinstall/issues/100