LINUX上pycharm远程解释器运行py程序在本地机器上显示plot命令画出来的图像
win10安装Xming
Xming的安装
远程ubuntu服务器上获得参数
windows平台使用SecureCRT+Xming执行linux平台的一些图形程序
source activate keras
输入env获得环境变量,得到DISPLAY的值
(keras) pc@ubuntu2:~$ env
XDG_SESSION_ID=521
TERM=vt100
SHELL=/bin/bash
SSH_CLIENT=222.201.187.158 56550 22
CONDA_SHLVL=1
CONDA_PROMPT_MODIFIER=(keras)
SSH_TTY=/dev/pts/23
LC_ALL=en_US.UTF-8
CUDA_HOME=/usr/local/cuda
USER=pc
LD_LIBRARY_PATH=/usr/local/cuda/lib64
......
......
XDG_RUNTIME_DIR=/run/user/1000
-------------------------------------------------
DISPLAY=localhost:10.0
-------------------------------------------------
LESSCLOSE=/usr/bin/lesspipe %s %s
_=/usr/bin/env
(keras) pc@ubuntu2:~$
获得matplotlib的后端配置
(keras) pc@ubuntu2:~$ python
Python 3.6.7 |Anaconda, Inc.| (default, Oct 23 2018, 19:16:44)
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib
>>> print(matplotlib.get_backend())
Qt5Agg
>>>
pycharm运行配置参数
- 要给每个需要运行的.py文件做如下预备工作,不然会报错
- 测试用代码
import matplotlib
import matplotlib.pyplot as plt
matplotlib.use('Qt5Agg')
print("hello")
x = [1, 2, 3, 4, 5]
y = [1, 4, 9, 16, 25]
plt.plot(x, y)
plt.show()