python matplotlib 画图show()不显示图
来源:互联网 发布:数据建模基础教程 pdf 编辑:程序博客网 时间:2024/04/30 13:41
我的环境是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])
[<matplotlib.lines.Line2D object at 0x7eff8d698550>]
>>> show()
图片正常显示了。
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])
[<matplotlib.lines.Line2D object at 0x7eff8d698550>]
>>> show()
图片正常显示了。
0 0
- python matplotlib 画图show()不显示图
- opensuse42下python matplotlib画图不显示
- matplotlib画图不显示
- 【Python开发】matplotlib绘图不显示问题解决plt.show()
- 【Python开发】matplotlib绘图不显示问题解决plt.show()
- sublime3运行matplotlib画图程序不显示图
- python画图matplotlib的Legend(显示图中的标签)
- Python matplotlib画图的中文显示问题
- python中matplotlib画图中文不能显示
- python2.7之matplotlib中plt.show()不显示图的解决办法
- 安装matplotlib 后 show()不显示图片
- 解决matplotlib库show()方法不显示图片
- 使用matplotlib时pyplot.show()不显示图像的问题
- Matplotlib画图不显示中文问题的解决方案
- python matplotlib画图 画多个子图
- Python matplotlib 画图相关
- python matplotlib 画图简介
- 使用python matplotlib画图
- Spring MVC控制层判断登录 ,登录失败则返回提示信息
- html-中文字体在CSS中的显示(Unicode编码)
- Java生成缩略图之Thumbnailator
- 死锁deadlock
- Intellij Idea 12 生成serialVersionUID的方法
- python matplotlib 画图show()不显示图
- C++第五次实验——项目二
- 抽象工厂模式 Abstract Factory Pattern
- mybatis获取xml文件中property对应的column
- .gitignore 的编写
- Android读写文件 获取文件并读取写入数据
- Android Dev Intro - Introducing GLSurfaceView
- IOS开发-VFL语言
- iOS开发—在@interface,@implementation和@property中变量的定义