• 博客园logo
  • 会员
  • 周边
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • YouClaw
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
不哭不闹,不吵不笑
博客园    首页    新随笔    联系   管理    订阅  订阅

windows+xshell+xming访问非桌面版Linux服务器 转:http://blog.csdn.net/jxxiaohou/article/details/51586934

错误信息::

  1. warnings.warn(_use_error_msg)  
  2. Traceback (most recent call last):  
  3.   File "/user-program/python/MachineLearninginAction/Chapter-02/test.py", line 12, in <module>  
  4.     plt.figure(figsize=(8,4))  
  5.   File "/usr/lib64/python2.7/site-packages/matplotlib/pyplot.py", line 527, in figure  
  6.     **kwargs)  
  7.   File "/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_tkagg.py", line 84, in new_figure_manager  
  8.     return new_figure_manager_given_figure(num, figure)  
  9.   File "/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_tkagg.py", line 92, in new_figure_manager_given_figure  
  10.     window = Tk.Tk()  
  11.   File "/usr/lib64/python2.7/lib-tk/Tkinter.py", line 1745, in __init__  
  12.     self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)  
  13. <span style="color:#ff0000;">_tkinter.TclError: no display name and no $DISPLAY environment variable</span>

解决办法::

1、Linux服务器 
(1)安装Firefox,目录为:/usr/local/firefox 
(2) 配置ssh 
#vi /etc/ssh/sshd_config 
取消下面一行的注释——如果没有这一行则手动添加之: 
X11Forwrding yes 
这样配置的作用就是允许SSH的X转发。

2、window客户机 
(1)安装xming 
Xming的主页:http://www.straightrunning.com/XmingNotes/ 
Xming的SourceForge页面:http://sourceforge.net/projects/xming/

从SourceForge下载Xming-setup.exe(最新的版本是6.9.0.31),在本地安装。 
第一次运行时使用开始菜单里面的XLaunch来启动,产生一个初始的配置文件。对于简单的使用来说,不需要任何特殊的配置,一切使用默认即可。Xming的具体配置和使用可以参考Xming的Manual。 
需要记住的是下图中标示出的“Display number”中的数字,此处使用默认的0。 
这里写图片描述

在windows客户机启动xming。启动完成后,在托盘区会出现一个“X”形状的图标,这表示Xming已经在运行了,将鼠标悬停上去,能看到当前使用的“Display number”

(2)xshell配置 
xshell属性

(3)连接 
在配置好xshell后,通过xshell连接到Linux服务器,并运行Firefox,就会在windows客户机看到Linux服务器运行的Firefox

Last login: Sat Jun 4 11:46:13 2016 from 202.96.135.237 
[root@localhost ~]# cd /usr/local/firefox 
[root@localhost firefox]# ./firefox

 
 
posted @ 2017-09-11 11:35  不哭不闹,不吵不笑  阅读(339)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2026
浙公网安备 33010602011771号 浙ICP备2021040463号-3