windows解决pycharm 使用远程调试功能时matplotlib plot出的图片无法查看问题

解决方法主要来自stackoverflow:
python-plotting-on-remote-server-using-pycharm
remote-debugging-with-pycharm-unable-plot-figure-on-local-machine

Ok, after some more googling I finally managed to get this process working, hope it helps somebody:

1) on remote host (VPS, Ubuntu 16.04) I had to install X11 server,
which I did by:

sudo apt-get install xorg sudo apt-get install openbox 2) On remote
host I had to make sure that X11Forwarding is enabled in
/etc/ssh/sshd_config

3) On local Win10 machine I had to install Xming server and launch it
with default settings.

4) On local Win10 machine I had to configure Putty to use X11
forwarding (Connection-> SSH -> X11 Forwarding) with default settings
and keep connection open while running PyCharm (it seems there is no
option in PyCharm to enable x11 forwarding, so putty must be running
in the background)

5) On remote machine I had to check Display number (echo $DISPLAY) -
this can be different for everyone. For me it was localhost:10.0

6) In PyCharm Run configuration -> Environment variables I had to add
DISPLAY=localhost:10.0

After all these steps and Putty+Xming running in backgroud, I was able
to execute remote code and bring graphic back to my Windows 10 PC!

PS - process is actually slow, I have to wait around 10 seconds before
image is brought back to me. I am not sure why or how to speed it up.
Might be another question. (reducing chipher strength and enabling
compression does not help. It seems some sort of initialization
problem with x11 remote and local)

x服务器选用xmanager、shell选用xshell可参考:
LINUX上pycharm远程解释器运行py程序在本地机器上显示plot命令画出来的图像
PyCharm远程开发调试,解决mtplotlib不显示图像问题

按照上文操作后仍无法正常显示则:

On Mac, it can be solved by, uncheck Settings | Tools | Python Scientific | Show Plots in Toolwindow. – Rockie Yang Mar 15 at 15:14

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值