今天在机子上安装matplotlib遇到一些问题,特将此记录下来,供大家分享以少走弯路。

1:下载matplotlib

        去官网上下载你所须要的版本号http://matplotlib.org/downloads.html,  注意这里的32位和64位指的是python版本号。因为是exe文件,直接安装就可以。

2:import matplotlib

当我在python shell 中使用命令import matplotlib时出现了下面错误

 

此时我们须要安装dateutil,这里须要使用easy_install来安装。此时能够在网上搜setuptools下载(http://blog.csdn.net/sudaobo/article/details/6636991) ,双击exe安装就可以,这个时候在D:\python27\scripts下就出现了easy_install.exe了 (win8人家说不支持exe,直接用官网的ez_setup.py安装)


这里将D:\python27\scripts加入到机子的环境变量中

然后在命令提示窗体中运行easy_install python-dateutil就可以。。

3:import matplotlib.pyplot as plt

        看上去全然正确了。但当我运行import matplotlib.pyplotas plt命令时,又出现“import matplotlib.pyplot as plt 出现ImportError:DLL load failed: %1 不是有效的win32程序”

这里主要是因为matplotlib版本号安装错了。安装成64位的了。

相关參考:http://jingyan.baidu.com/article/aa6a2c14d5aa7f0d4c19c4e2.html

http://jingyan.baidu.com/article/e4d08ffdd3b9690fd2f60de2.html

作者:小村长  出处:http://blog.csdn.net/lu597203933 欢迎转载或分享,但请务必声明文章出处。 (新浪微博:小村长zack, 欢迎交流!)