在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. JAVA字符串的相关练习

    /*String s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";//生成随机验证码 fo ...

  2. sql 多行转换为一行

    select 字段1, [val]=( select 字段2 +',' from 表名 as b where b.字段1 = a.字段1  for xml path('')) from 表名 as a ...

  3. css 变量与javascript结合

    <div onClick="test('yellow')"> CSS Variable</div> ================CSS :root{ - ...

  4. SYN攻击

    一.TCP握手协议 在TCP/IP协议中,TCP协议提供可靠的连接服务,采用三次握手建立一个连接. 第一次握手:建立连接时,客户端发送syn包(syn=j)到服务器,并进入SYN_SEND状态,等待服 ...

  5. vs2012 error c4996: This function or variable may be unsafe

    编译lua源码时,使用vs2012,遇到如下错误. 1>------ 已启动生成: 项目: 20130925, 配置: Debug Win32 ------ 1>  stdafx.cpp ...

  6. HTML中强大的input标签属性

    用了许久的html,<input>这个标签是最常用的标签之一. <input type="">标签中type属性是必不可少的,以往我最常用的有 type=& ...

  7. Java String.split()小点

    java String.split(); 别的不说,单说其中一个问题,这个函数去切分空字符串时,得到的结果: public static void main(String[] args) {// St ...

  8. eap-md5

    eap-md5       文件路径 用途 示例 备注 #gedit /usr/local/etc/raddb/sites-available/default #gedit /usr/local/et ...

  9. hdu 2069

    #include "stdio.h" int main(){ int num,i1,i2,i3,i4,i5,n; int n1,n2,n3,n4,n5; while(~scanf( ...

  10. UIKit框架之UITouch

    1.继承链:NSObject 2.获取触发点的位置 (1)- (CGPoint)locationInView:(UIView *)view :返回指定视图的触发点的位置 (2)- (CGPoint)p ...