第一种使用# %%
vscode就可以像jupyter一样在VScode中显示图片
第二种方法使用 VcXsrv
下载地址:
VcXsrv Windows X Server download | SourceForge.net
安装时选项默认就好,然后打开VcXsrv
下一页
这里要记得把第三个勾选上
在ubuntu 的.bashrc中添加如下代码:
export DISPLAY=$(awk '/nameserver / {print $2; exit}' /etc/resolv.conf 2>/dev/null):0
export DISPLAY=:0
export LIBGL_ALWAYS_INDIRECT=1
重启wsl,就可以在vscode中正常plt.show()使用了