centos 安装 matplotlib

前端之家收集整理的这篇文章主要介绍了centos 安装 matplotlib前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。


1.yum search matplotlib

返回结果是:

[root@dn1 Desktop]# yum search matplotlib
Loaded plugins: fastestmirror,langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.btte.net
* extras: mirrors.btte.net
* updates: mirrors.skyshe.cn
=========================== N/S matched: matplotlib ============================
python-matplotlib-doc.x86_64 : Documentation files for python-matplotlib
python-matplotlib-qt4.x86_64 : Qt4 backend for python-matplotlib
python-matplotlib-tk.x86_64 : Tk backend for python-matplotlib
python-matplotlib.x86_64 : Python 2D plotting library


选择最下方的那个,安装

2.yum installpython-matplotlib.x86_64

它会把一切依赖给你装上。完毕。


3. 使用pip进行matplotlib安装

pip install matplotlib


4.执行命令测试是否成功

python

>>> import matplotlib

>>>

5.安装matplotlib所需的tkinter,否则报ImportError: No module named '_tkinter'

yum -y install tkinter


问题:

Non-ASCII character '\xe5' in file Apriori.py on line 1,but no encoding declared 解决办法

python中出现Non-ASCII character '\xe7' in file ex6.py on line 1,but no encoding declare的错误

可按照错误建议网址查看http://www.python.org/peps/pep-0263.html

发现是因为Python在默认状态下不支持文件中的编码所致。解决方案有如下三种:

一、在文件头部添加如下注释码:

# coding=<encoding name> 例如,可添加# coding=utf-8

二、在文件头部添加如下两行注释码:

#!/usr/bin/python

# -*- coding: <encoding name> -*- 例如,可添加# -*- coding: utf-8 -*-

三、在文件头部添加如下两行注释码:

# vim: set fileencoding=<encoding name> : 例如,可添加# vim: set fileencoding=utf-8



转载:http://blog.csdn.net/vickyrocker1/article/details/49070733


参考:http://blog.csdn.net/junbujianwpl/article/details/51170745

http://blog.csdn.net/dd809477679/article/details/52101195

猜你在找的CentOS相关文章