【问题标题】:Cant run Qt python application, "qt.qpa.plugin: Could not find the Qt platform plugin "cocoa" in "无法运行 Qt python 应用程序,“qt.qpa.plugin:在“中找不到 Qt 平台插件“cocoa”
【发布时间】:2021-01-23 05:08:53
【问题描述】:

我使用 Qt 设计器为 Python 应用程序制作了一个 UI。我使用pyuic5.ui 文件创建了python 代码文件。但是,当我尝试运行我的应用程序时,出现此错误:`

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.

我是 Qt 新手,我使用 Brew 安装了它,并且我正在使用带有 Python 3.9.1 的 Conda 环境。

编辑:我只是尝试从 github 下载 qt 生成的 py 文件,当我自己没有创建 .py 文件时,它可以工作。不过,我应该怎么做才能从我的 .ui 文件中生成 .py 文件。

【问题讨论】:

    标签: python qt


    【解决方案1】:

    问题是我使用了 Qt 编译器,而在我的代码中使用了 pyside2。当我使用uic -g python -o <ouput_python_file> <input_ui_file> 编译它时,一切正常。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-06-25
      • 1970-01-01
      • 1970-01-01
      • 2021-09-03
      • 2019-01-25
      • 2020-10-05
      • 1970-01-01
      • 2018-05-17
      相关资源
      最近更新 更多