您的位置:首页 > 编程语言 > Python开发

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

2015-04-11 21:29 711 查看
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 "<pyshell#27>", line 1, in <module>
import matplotlib
File "D:\program files\Python27\lib\site-packages\matplotlib\__init__.py", line 105, in <module>
import six
ImportError: No module named six


解决方案:

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

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


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

<span style="font-size:14px;">>>> import matplotlib

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


解决方案:
D:\program files\Python27\Scripts>python -m pip install python-dateutil


>>> import matplotlib

Traceback (most recent call last):
File "<pyshell#30>", line 1, in <module>
import matplotlib
File "D:\program files\Python27\lib\site-packages\matplotlib\__init__.py", line 140, in <module>
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'
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: