win7 64位 python安装 matplotlib

来源:互联网 发布:llmnr linux 编辑:程序博客网 时间:2024/06/04 23:37

参考:http://blog.csdn.net/walkandthink/article/details/45200597

但是,其中有些描述错误或者过时,2017.3.3重新整理简洁版如下:

1,安装python 2.7,略

2,安装Numpy,SciPy,MatplotLib (注意,不能像上篇文章中说的用32位的exe安装,不匹配)

(1) pip install numpy

(2) pip install scipy  失败("window raise NotFoundError('no lapack/blas resources found') "),替换成:

    (2.1)下载 http://www.lfd.uci.edu/~gohlke/pythonlibs/tugh5y6j/scipy-0.18.1-cp27-cp27m-win_amd64.whl

    (2.2)pip install scipy-0.18.1-cp27-cp27m-win_amd64.whl

(3) pip install MatplotLib


3,用test.py代码验证,成功!:

from mpl_toolkits.mplot3d import axes3d
import matplotlib.pyplot as plt
from matplotlib import cm

fig = plt.figure()
ax = fig.gca(projection='3d')
X, Y, Z = axes3d.get_test_data(0.05)
ax.plot_surface(X, Y, Z, rstride=8, cstride=8, alpha=0.3)
cset = ax.contour(X, Y, Z, zdir='z', offset=-100, cmap=cm.coolwarm)
cset = ax.contour(X, Y, Z, zdir='x', offset=-40, cmap=cm.coolwarm)
cset = ax.contour(X, Y, Z, zdir='y', offset=40, cmap=cm.coolwarm)

ax.set_xlabel('X')
ax.set_xlim(-40, 40)
ax.set_ylabel('Y')
ax.set_ylim(-40, 40)
ax.set_zlabel('Z')
ax.set_zlim(-100, 100)

plt.show()


0 0