pythondjango无法显示画图show_python matplotlib 画图show()不显示图

我的环境是centos6.3默认有个python2.6,自己又装了个python2.7版本,

matplotlib 使用show()无法显示,从网上各种查找问题,发现自带的python2.6版本可以显示图片,

但新python2.7不可以显示

1. 确保是在Linux的桌面环境下运行而不是从纯终端或ssh客户端

2. plt.show()依赖一个图形环境, 如tk, wxpython等, 要先安装一个

装了个wxpython

yum install epel-release

yum clean all

yum install wxPython

#vim simple_plot.py

from pylab import *

plot([1,2,3])

show()

[root@testserver4 ~]# python simple_plot.py --verbose-helpful

$HOME=/root

matplotlib data path /usr/local/lib/python2.7/site-packages/matplotlib-1.5.0-py2.7-linux-x86_64.egg/matplotlib/mpl-data

*****************************************************************

You have the following UNSUPPORTED LaTeX preamble customizations:

Please do not ask for support with these customizations active.

*****************************************************************

loaded rc file /usr/local/lib/python2.7/site-packages/matplotlib-1.5.0-py2.7-linux-x86_64.egg/matplotlib/mpl-data/matplotlibrc

matplotlib version 1.5.0

verbose.level helpful

interactive is False

platform is linux2

CACHEDIR=/root/.cache/matplotlib

Using fontManager instance from /root/.cache/matplotlib/fontList.cache

backend agg version v2.2

使用源码安装matplotlib

Source install from git

Clone the main source using one of:

>git clone git://github.com/matplotlib/matplotlib.git

and build and install as usual with:

> cd matplotlib

> python setup.py install

> python setup.py build

应该是系统自带的python2.6和新装的python2.7之间哪个设置有问题,各种网上搜索,有提问的,但是没有解决的方法,

最终我使用python集成工具Anaconda解决了这个问题,安装方法参考: http://blog.csdn.net/levy_cui/article/details/51143153

# python

Python 2.7.11 |Anaconda 2.4.1 (64-bit)| (default, Dec  6 2015, 18:08:32)

[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux2

Type "help", "copyright", "credits" or "license" for more information.

Anaconda is brought to you by Continuum Analytics.

Please check out: http://continuum.io/thanks and https://anaconda.org

>>> from pylab import *

>>> plot([1,2,3])

[]

>>> show()

图片正常显示了。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值