windows下安装matploblib

matplotlib是python著名的绘图库,它提供了一整套和matlab相似的命令API,下面介绍在windows下的安装步骤:

1、python下载安装 ( 下载地址),选择安装python 2.7.*,python 3.*版本安装某些模块会出问题

2、安装matplotlib还需要安装numpy, scipy

    numpy :http://sourceforge.net/projects/numpy/files/NumPy/1.8.1/   下载下面的numpy-1.8.2-win32-superpack-python2.7

         scipy:http://sourceforge.net/projects/scipy/files/

         matplotlib:matplotlib-1.1.0.win32-py2.7

3、msvcp71.dll, 在某些系统上,你可能还需要下载msvcp71.dll库。下载

     这个文件,解压后把它拖到c:\windows\system32目录中。

5、安装deateutil,下载地址

6、安装pyparsing,下载地址

7、下载安装six模块: https://pypi.python.org/pypi/six/,下载six-1.4.1.tar.gz 包,解压,将里面的six.py文件放到c盘python27目录的Lib下。

 

安装过程中如遇到问题需要一些依赖包,可以到这里寻找相应资源,但是这里的资源都是.whl格式,需要安装pip,以下是pip的安装步骤:

1、windows用户只需要  下载 get-pip.py文件,在python中运行,如果运行成功你可以看到$PYTHON_PATH/Script/ 下出现pip.* 等几个文件

2、 如何使用呢,首先将$PYTHONPATH , $PYTHONPATH\Scripts添加到系统PATH中,接下来就可以在windows的cmd下安装啦。或者直接到Scripts目录下,运行pip也行 

pip install whatever.whl

 

验证matplotlib是否安装成功:

import matplotlib
import numpy
import scipy
import pyparsing
import matplotlib.pyplot as plt

 

示例:

import numpy as np
import matplotlib.pyplot as plt

# Compute the x and y coordinates for points on a sine curve
x = np.arange(0, 3 * np.pi, 0.1)
y = np.sin(x)

# Plot the points using matplotlib
plt.plot(x, y)
plt.show()  # You must call plt.show() to make graphics appear.

 

  

 

posted @ 2015-06-02 18:01  dupuleng  阅读(665)  评论(0)    收藏  举报