在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. 显示隐藏文件 .DS_Store文件

    1. mac为了保护系统文件和减少对用户的干扰,提高用户体验,将一些系统文件隐藏了起来,如hosts配置文件,.DS_Store文件 (Desktop Services Store),.localiz ...

  2. json转类

    JavaScriptSerializer js = new JavaScriptSerializer();T detaile = js.Deserialize<T>(json);

  3. Android中ListView的各种显示效果

    在android应用开发中,ListView是使用频率非常高的一个组件,基本上稍微复杂点的布局都会用到它,利用它可以让你的界面美观,有层次 .ListView可以用来作为数据显示的容器,也可以作为界面 ...

  4. LeetCode 4 Median of Two Sorted Arrays 查找中位数,排除法,问题拓展 难度:1

    思路:设现在可用区间在nums1是[s1,t1),nums2:[s2,t2) 1.当一个数组可用区间为0的时候,由于另一个数组是已经排过序的,所以直接可得 当要取的是最小值或最大值时,也直接可得 2. ...

  5. 【Python扩展阅读【转】EasyGui 学习文档【超详细中文版】】

    翻译改编自官方文档:http://easygui.sourceforge.net/tutorial/index.html 翻译改编者:小甲鱼,本文欢迎转载,转载请保证原文的完整性! 演示使用 Pyth ...

  6. Bootstrap <基础二十二>超大屏幕(Jumbotron)

    Bootstrap 支持的另一个特性,超大屏幕(Jumbotron).顾名思义该组件可以增加标题的大小,并为登陆页面内容添加更多的外边距(margin).使用超大屏幕(Jumbotron)的步骤如下: ...

  7. html5移动web开发笔记(一)Web 存储

    localStorage - 没有时间限制的数据存储 localStorage 方法 localStorage 方法存储的数据没有时间限制.第二天.第二周或下一年之后,数据依然可用. 用户访问页面的次 ...

  8. 【浅层优化实战】ssh远程登录Linux卡慢的全过程排查及解决方案

    ssh远程登录Linux卡慢的全过程排查及解决方案 前言: 在linux操作系统使用过程中偶然一次感到使用ssh远程连接软件连接操作系统需要等待许久,第一次没在意,第二次也没在意,第三次有点忍受不住了 ...

  9. python 中的高级函数map()

    map()是 Python 内置的高阶函数,它接收一个函数 f 和一个 list,并通过把函数 f 依次作用在 list 的每个元素上,得到一个新的 list 并返回. 例如,对于list [1, 2 ...

  10. I had lots of shrapnel in my leg

    People were running up to us, and screaming and hitting us, and throwing stones and eggs. "They ...