xshellpycharm show remote img | xshell命令窗口显示服务器图片

tech2026-04-13  9

change /etc/ssh/sshd_config and restart: # X11Forwarding yes -> X11Forwarding yes

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")
最新回复(0)