sudo apt install x11-xserver-utils
xhost + # change control access
如果报错,参考安装vncserver,但是里面设置的DISPLAY变量是错的,然后设置export DISPLAY=:x.0,x是vnc设置的窗口号,然后再执行xorg + 应该就没有问题了echo $DISPLAY # if not none, then success
install xming in win10 and start it
install xshell in win10 and allow x11 transfering to X DISPLAY: localhost:0.0 in property tunnel
if you want use it in pycharm, setup remote interpreter and deployment, then edit run/debug configuration to set environment variables with DISPLAY: localhost:xx.0 (xx same with $DISPLAY in remote server)
为了测试是否设置成功,只需要在xshell中ssh到远程服务器,进入python 命令行, 输入以下命令,如果有弹出小窗口,则表示设置成功
import cv2 cv2.namedwindow("img")