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

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

sudo service sshd restart

  • sudo apt install x11-xserver-utils

  • xhost + # change control access

    • 如果报错,参考安装vncserver,但是里面设置的DISPLAY变量是错的,然后设置export DISPLAY=:x.0,x是vnc设置的窗口号(注意运行 vncserver 后的logs, ex: New ‘ubuntu:1 (ubuntu)’ desktop at :1 on machine ubuntu, 这时窗口号是1),然后再执行xhost + 应该就没有问题了
  • 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")
附录:vnc 安装教程

https://blog.csdn.net/cunchi4221/article/details/107471665

xshell ssh 连结服务器 后显示:WARNING! The remote SSH server rejected X11 forwarding request.

warning

网上大都建议设置 sshd_config, 我按照要求设置后 ,并无效果,最终找到了是 IPV6 的问题,如果只支持ipv4, 修改sshd_config 中的AddressFamily inet,然后重启ssh service ,问题就应该就解决了

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值