在cetos 服务器使用源码包,安装matplotlib, 安装成功后,

  import pylab as pl

  pl.figure(figsize=(16,8))

python 解析器报错,Invalid DISPLAY variable

google后得到解决方法

  import matplotlib

  matplotlib.use('Agg')

  import pylab as pl

pl.figure(figsize=(16,8))

解释器通过,并成功绘图.

原文连接:

http://stackoverflow.com/questions/2801882/generating-a-png-with-matplotlib-when-display-is-undefined

pylab,matplotlib Invalid DISPLAY variable的更多相关文章

  1. ssh调用matplotlib绘图报错RuntimeError: Invalid DISPLAY variable

    1.问题:在本地用matplotlib绘图可以,但是在ssh远程绘图的时候会报错 RuntimeError: Invalid DISPLAY variable 2.原因:matplotlib的默认ba ...

  2. [Python] RuntimeError: Invalid DISPLAY variable

    1.问题:在本地用matplotlib绘图可以,但是在ssh远程绘图的时候会报错 RuntimeError: Invalid DISPLAY variable 2.原因:matplotlib的默认ba ...

  3. 错误RuntimeError: Invalid DISPLAY variable

    原因:matplotlib的backend中的FltkAgg, GTK, GTKAgg, GTKCairo, TkAgg , Wx or WxAgg这几个backend都要求有GUI图形界面的 首先查 ...

  4. matplotlib 绘图报错 RuntimeError: Invalid DISPLAY variable

    ssh 远程登录 Linux 服务器使用 matplotlib.pyplot 绘图时报错 原因: matplotlib 在 windows 下的默认 backend 是 TkAgg:在 Linux 下 ...

  5. class java.awt.HeadlessException : No X11 DISPLAY variable was set, but this program performed an operation which requires it.

    今天上午打印回单功能发布到测试环境,报了: class java.awt.HeadlessException : No X11 DISPLAY variable was set, but this p ...

  6. Can't connect to X11 window server using ':1.0' as the value of the DISPLAY variable.

    安装oracle数据时需要用到图形界面安装,当我们用root用户登录后切换到oracle用户时运行./runInstaller提示报错: Can't connect to X11 window ser ...

  7. No X11 DISPLAY variable was set

    在命令行调用图形化界面时报错 “No X11 DISPLAY variable was set” 首先使用xclock命令查看是否能调出时钟,如果不行,使用如下命令: 打开xmanager – pas ...

  8. Can't connect to X11 window server using 'localhost:10.0' as the value of the DISPLAY variable.

    刚刚在一台Linux服务器上安装了jdk和Tomcat,然后部署了一个web项目,在项目中有个添加图片的功能,保存图片时报错 org.springframework.web.util.NestedSe ...

  9. Linux启动应用(比如jmeter)报An error occurred: Can't connect to X11 window server using ':0.0' as the value of the DISPLAY variable.

    Linux启动应用(比如jmeter)报An error occurred: Can't connect to X11 window server using ':0.0' as the value ...

随机推荐

  1. JQUERY MOBILE 中文API站 和 官方论坛

    中文API站:http://www.jqmapi.com/api1.2/preview/quickstartquide.html 官方论坛:http://bbs.phonegapcn.com/foru ...

  2. iOS UIWebView 添加tap手势 和 添加button 遇到的问题

    今天应产品需求,在UIWebView 上添加一个 单机手势和双击手势,再加一个UIButton,UIButton 绑定一件事情,结果遇到了点击button 的点击事件的时候,单机手势 的响应事件,被响 ...

  3. hdoj 1385Minimum Transport Cost

    卧槽....最近刷的cf上有最短路,本来想拿这题复习一下.... 题意就是在输出最短路的情况下,经过每个节点会增加税收,另外要字典序输出,注意a到b和b到a的权值不同 然后就是处理字典序的问题,当松弛 ...

  4. CentOS 静态IP设置

    一.CentOS 修改IP地址修改对应网卡的IP地址的配置文件 # vi /etc/sysconfig/network-scripts/ifcfg-eth0   电信 # vi /etc/syscon ...

  5. php防止外链导出的代码

    先收藏起来再说! URL跳转代码 1.代码: <? $url=$_GET["url"];header("Location:"."http://& ...

  6. svd自我学习

    svd(singular value decomposition) 奇异值分解  2015-05-17 16:28:50 图和部分内容来自:http://blog.csdn.net/wangzhiqi ...

  7. 查询oracle版本信息

    select * from v$version;select * from v$instance;select * from nls_database_parameters;select * from ...

  8. father of the archangel of death"?

    e wields an axe, a sword and a machine gun and his battlefield pranks have become as legendary as hi ...

  9. Ibatis动态拼装sql,常用标签总结及举栗子。

    今天得到项目经理一项任务,就是拼装sql,第一次见到,不是太懂,赶紧回来睡一觉再说,由于这次的项目orm使用的是ibatis框架,所以需要使用动态拼装sql,或者是ognl语言,这门语言不是专属于ib ...

  10. Empty 和空字符串区别

    如果 var 是非空或非零的值,则 empty() 返回 FALSE. 换句话说,"".0."0".NULL.FALSE.array().var $var; 以 ...