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

【python】matplotlib在windows10 和win7下安装

2015-09-28 18:43 826 查看
win7系统升级win10后重装matplotlib

file resources



win10 64位操作系统

1)Python2.7 64位 环境变量path
python安装路径

2)pip-8.1.1 (source) 命令:python setup.py install

环境变量path
D:\sftwre_path\python27\Scripts

3)安装完pip后所有的wheel文件都用这个命令安装,图上所需的wheel文件都可以从链接4找到,顺序可以numpy,dateutil,pyparsing,six,scipy,最后matplotlib

命令:

pip install wheel

pip install *.wheel

4)用代码测试

这是之前win7 64位安装查找的资料(转载)

链接1 http://blog.sciencenet.cn/blog-579770-738240.html
链接2 http://www.open-open.com/lib/view/open1393488232380.html
链接3 http://blog.csdn.net/yang6464158/article/details/18546871#comments
链接4 http://www.lfd.uci.edu/~gohlke/pythonlibs/
链接123是靠谱的安装过程;此过程中需要的各种程序包都能在链接4(非官方下载,比较全)里找到。

注意:各个安装程序的版本必须一致,这里都统一用windows,64 bit,python2.7版本(据说Python3.*系列对于一些安装包不兼容,故选取了比较旧的python2.7版本)!!!!

1、python下载地址https://www.python.org/download/

2、安装与python相对应版本的Matplotlib,下载地址http://matplotlib.org/downloads.html

3、对于标准版本的Python,要使用Matplotlib,需要安装numpy模块,下载地址见链接4

4、可能还会用到msvcp.dll库,自行在网上搜一个添加到C:windowssystem32目录下。
此时如果运行 import matplotlib.pyplot as plt 可能会显示以下错误:
raise ImportError("matplotlib requiresdateutil")
ImportError: matplotlib requires dateutil
意味着需要dateutil

5、安装dateutil,下载地址http://www.lfd.uci.edu/~gohlke/pythonlibs/#python-dateutil
此后又出现错误:
raise ImportError("matplotlib requirespyparsing")
ImportError: matplotlib requires pyparsing
意味着需要pyparsing

6、安装pyparsing,下载地址http://www.lfd.uci.edu/~gohlke/pythonlibs/#pyparsing
安装完又出现错误:
No module name six
需要安装scipy

7、安装scipy,下载地址见链接4。
然后把C:Python27Libsite-packagesscipylib中的six.py six.pyc six.pyo三个文件拷贝到C:Python27Libsite-packages目录下。
再在IDLE(Python GUI)中输入import matplotlib.pyplot as plt便可以解决啦!

8、输入以下代码不报错:
import matplotlib
import numpy
import scipy
import pyparsing
import matplotlib.pyplot as plt

9、验证一个简单的例子
import matplotlib.pyplot as plt
plt,plot([1,2,3])
plt.ylabel('some numbers')
plt.show()

10、其他有用的链接:

example: http://matplotlib.org/examples/index.html gallery:http://matplotlib.org/gallery.html
http://blog.csdn.net/pzy20062141/article/details/48730985
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: