实际上,python的安装很简单,下载安装软件,一路Yes、Ok就可以了。但是要安装其他模块或者包的时候,就比较麻烦,要逐个的去下载,典型地Linux方式。简单的办法就是使用EPD发布,它包含了科学计算等很多包,应该够用了。
下面介绍matplotlib的安装,够麻烦的:
Matplotlib在windows下安装有些复杂,折腾了很久,终于搞定了,下面把我的安装教程分享给大家。
前面步骤转载自:Daniel的技术笔记
Matplotlib的安装可以参见官网链接 http://matplotlib.org/users/installing.html
下面总结步骤如下:
windows 平台上下载.exe格式直接安装。
1,python下载安装 下载地址。
2,安装你所需要版本(这个要根据步骤1的python版本)的Matplotlib,下载地址。
下面安装Matplotlib 依赖的库
3, 对于标准版的Python来说,要使用Matplotlib,还需要安装numpy模块,其下载地址。
4, msvcp71.dll, 在某些系统上,你可能还需要下载msvcp71.dll库。下载
这个档案,解压后把它拖到c:\windows\system32目录中。
5, 运行一个简单的程序例子:
[python]
1. import matplotlib.pyplot as plt
2. plt.plot([1,2,3])
3. plt.ylabel('some numbers')
4. plt.show()
发现出现了下面的错误:
raise ImportError("matplotlib requiresdateutil")
ImportError: matplotlib requires dateutil
这个需要dateutil,你可以到这里下载安装。
把dateutil 安装完后又出现如下错误:
raise ImportError("matplotlib requirespyparsing")
ImportError: matplotlib requires pyparsing
需要 pyparsing 到这里下载安装。
安装完pyparsing出现如下错误:
No module name six
去pypi上下载six-1.4.1.tar.gz
这个安装很简单,直接把它解压到python的安装目录就ok了,我的是C:\Python33
在Ipython里测试如下
在程序安装过程中如果遇到需要安装的一些依赖包,你可以到这里查找,确实是个好资源。
可以根据所画图形的需要在下面的链接里选择相应的图形进行修改,绘出自己所需的图像。
example: http://matplotlib.org/examples/index.html, gallery:http://matplotlib.org/gallery.html
注意绘图时中文的解决方法, 在.py文件头部加上如下内容:
- # -*- coding: utf-8 -*-
- from pylab import *
- mpl.rcParams['font.sans-serif'] = ['SimHei'] #指定默认字体
- mpl.rcParams['axes.unicode_minus'] = False #解决保存图像是负号'-'显示为方块的问题
本文引用地址:
http://blog.sciencenet.cn/blog-579770-738240.htm