解决qt.qpa.xcb: could not connect to display问题

以服务器作为远程解释器,本地pycharm或vscode调试时出现如下错误:

qt.qpa.xcb: could not connect to display
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/home/xx/anaconda3/lib/python3.8/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, minimal, minimalegl, offscreen, vnc

第一步:安装远程ssh软件MobaXterm(或其他支持图形回传的远程软件)
附上安装包链接:https://pan.baidu.com/s/1ICNpYK-95tCoMjZMJRcZlg
提取码:ohgp
输入下面命令echo $DISPLAY
第二步:在VScode终端,输入:export DISPLAY=localhost:10.0
在这里插入图片描述
注:每次都需要

你可能感兴趣的:(Linux,qt,vscode)