• Could not load the Qt platform plugin “xcb“ in


    在Linux上用Vscode调试MAPPO代码时碰到“Could not load the Qt platform plugin “xcb” in…”问题,问题详细描述如下:

    qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/home/cloris/anaconda3/envs/py37/lib/python3.7/site-packages/cv2/qt/plugins" even though it was found.
    This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

    Available platform plugins are: xcb, eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, webgl.

    报错原图:
    网上查找解决方法如下:
    在终端输入如下代码:

    export QT_QPA_PLATFORM=offscreen

    成功解决问题

    上面适用 没有显示器的时候,如果有显示器,设置成offscreen会报下面的错误:

    X Error of failed request: BadWindow (invalid Window parameter) Major opcode of failed request: 3 (X_GetWindowAttributes) Resource id in failed request: 0x4 Serial number of failed request: 7 Current serial number in output stream: 8

    这时候只需要把参数设置成 

    export QT_QPA_PLATFORM=xcb

    --------------------------------------------------------------------------------------------------------------

    QT_QPA_PLATFORM环境变量用于设置Qt应用程序的平台插件,以指定Qt应用程序在不同图形平台上的行为。这个环境变量的值可以设置为不同的参数,以满足不同的需求。以下是一些常见的QT_QPA_PLATFORM值以及它们的含义:

    1. linuxfb: 使用Framebuffer作为图形输出,适用于嵌入式Linux系统等。

    2. xcb: 使用X Window系统(X11)作为图形输出,这是Linux和Unix系统上常用的默认选项

    3. windows: 使用Windows操作系统上的本机图形接口。

    4. minimal: 使用Qt的最小平台插件,通常用于测试或构建最小化Qt应用程序。

    5. offscreen: 在没有显示器的情况下运行应用程序,通常用于无头(headless)或远程服务器上的应用程序。

    6. android: 用于Android平台上的Qt应用程序。

    7. macos: 用于macOS上的Qt应用程序。

    8. wayland: 使用Wayland图形协议作为图形输出,通常用于现代Linux桌面环境。

  • 相关阅读:
    001 redis高并发减库存
    Thread中的方法测试(run,yield,sleep,start,join等)
    feign配置hystrix,增加熔断降级,两种情况的不同配置
    Vue18 v-for指令 展示列表数据
    TypeScript入门
    【牛客面试必刷TOP101】Day4.BM15删除有序链表中重复的元素-I和BM17二分查找-I
    14:00面试,14:06就出来了,问的问题有点变态。。。。。。
    FPGA优质开源项目 – UDP万兆光纤以太网通信
    python_data_analysis_and_mining_action-master-8
    08-高性能表结构及索引设计最佳实践-03
  • 原文地址:https://blog.csdn.net/baobei0112/article/details/133310070