matplotlib 和 numpy下载与安装(基于Python2.7.9)

matplotlib是基于numpy的,所以必须先安装numpy。

1、下载numpy

numpy下载地址:http://sourceforge.net/projects/numpy/files/NumPy/

numpy下载版本为1.9.2

numpy-1.9.2-win32-superpack-python2.7.exe

2、安装numpy

点击安装包进行安装

选择与Python相同的安装目录(例如:D:\program files\Python27)

3、检查numpy是否安装成功

在Python IDLE中输入

>>> import numpy
>>> numpy.__version__
'1.9.2'

4、下载matplotlib

Matplotlib下载地址:http://sourceforge.net/projects/matplotlib/files/matplotlib/matplotlib-1.4.3/windows/

Matplotlib下载版本:1.4.3

matplotlib-1.4.3.win32-py2.7

5、安装matplotlib

点击安装包进行安装

选择与Python相同的安装目录(例如:D:\program files\Python27)

6、检查matplotlib是否安装成功

在Python IDLE中输入

>>> import matplotlib

Traceback (most recent call last):
  File "", line 1, in 
    import matplotlib
  File "D:\program files\Python27\lib\site-packages\matplotlib\__init__.py", line 105, in 
    import six
ImportError: No module named six

解决方案:

进入系统命令行模式下(cmd),在如下目录下执行命令:

D:\program files\Python27\Scripts>python -m pip install six


再进行测试,出现如下问题:

>>> import matplotlib

Traceback (most recent call last):
  File "", line 1, in 
    import matplotlib
  File "D:\program files\Python27\lib\site-packages\matplotlib\__init__.py", line 116, in 
    raise ImportError("matplotlib requires dateutil")
ImportError: matplotlib requires dateutil

解决方案:

D:\program files\Python27\Scripts>python -m pip install python-dateutil


>>> import matplotlib

Traceback (most recent call last):
  File "", line 1, in 
    import matplotlib
  File "D:\program files\Python27\lib\site-packages\matplotlib\__init__.py", line 140, in 
    raise ImportError("matplotlib requires pyparsing")
ImportError: matplotlib requires pyparsing

解决方案:

D:\program files\Python27\Scripts>python -m pip install pyparsing


安装成功!

>>> import matplotlib
>>> matplotlib.__version__
'1.4.3'


你可能感兴趣的:(Python,Matplotlib)