qt.qpa.xcb: could not connect to display qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
时间: 2023-08-17 08:10:19 浏览: 302
Ubuntu18.04下解决Qt出现qt.qpa.plugin:Could not load the Qt platform plugin “xcb“问题
5星 · 资源好评率100%
这个错误是由于远程连接服务器时无法直接传回图形界面导致的。这个错误通常在使用Qt库时出现,比如在代码中使用了cv.imshow()函数。解决这个问题的方法有两种:
1. 不要求传回图像且不报错的解决方案是注释掉与cv.imshow()相关的代码。这样可以避免出现错误。
2. 另一种解决方案是通过修改配置文件来解决。你可以使用以下命令打开配置文件:
sudo vim /etc/profile
在打开的文件中,你可以添加以下内容来设置环境变量:
export QT_QPA_PLATFORM_PLUGIN_PATH=/usr/local/qt5pi/plugins/platforms
保存并退出文件后,重新启动你的应用程序,这样应该就能够解决这个错误了。
请注意,这些解决方案适用于不同的情况,具体的解决方法可能因个人环境而异。建议你根据自己的情况选择适合的解决方案。
#### 引用[.reference_title]
- *1* [qt.qpa.xcb: could not connect to display qt.qpa.plugin: Could not load the Qt platform plugin “xcb](https://blog.csdn.net/qq_43248104/article/details/131381976)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down1,239^v3^insert_chatgpt"}} ] [.reference_item]
- *2* [解决qt.qpa.xcb: could not connect to display问题](https://blog.csdn.net/every_step/article/details/120640384)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down1,239^v3^insert_chatgpt"}} ] [.reference_item]
- *3* [远程服务器时Ubuntu报错:qt.qpa.xcb: could not connect to display](https://blog.csdn.net/liuyang_xyz/article/details/126520299)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down1,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文