关于pylab的安装与使用等相关问题

PyLab Python模块,属于Matplotlib数学库。PyLab结合数值与图形绘制模块模块numpy pyplot。PyLab交互式Python解释器的设计思想,因此它的许多功能是很经典的(属于小而巧那种)。这使得它非常有效和方便的数学工具。如果你想安装PyLab,您还必须安装Matplotlib。这个过程相当简单,采用标准的安装过程;
windows下的安装:pip install -U matplotlib
或者easy_install matplotlib (但这两种我都没有成功。。唉~)
最好使得就是下载exe直接抽取安装
模块下载地址:matplotlib模块下载地址whl文件
或者matplotlib exe文件(推荐这个~简单!)
参考文章:Python-Matplotlib安装及简单使用
使用pylab还需要安装numpy,scipy等模块,以及dateutil 和 pyparsing;(但亲测我只装了pyparsing)
下载地址:pyparsing下载
或者在cmd环境下直接pip install -U pyparsing or easy_install pyparsing也可以;

好~安装完后,我在Python 命令窗口输入import matplotlib出现了错误。。。
matplotlib错误表现
……………………………..
经过网上查阅解决办法有人提出
解决办法
然而在我手里面删掉了init.py运行仍然还是有问题,一怒之下将里面关于初始化的init的相关的3个文件都删了~~
最后的解决办法

~~~~~~~~~~奇迹就出现了~~~~~~~~~~~~~~
这里写图片描述

附录:[示例程序]>>>>>>来源于网络

__author__ = 'Administrator'
import numpy as np
#import matplotlib.pyplot as plt
from matplotlib import pyplot as plt
N = 5
menMeans = (20, 35, 30, 35, 27)
menStd =   (2, 3, 4, 1, 2)

ind = np.arange(N)  # the x locations for the groups
width = 0.35       # the width of the bars

fig, ax = plt.subplots()
rects1 = ax.bar(ind, menMeans, width, color='r', yerr=menStd)

womenMeans = (25, 32, 34, 20, 25)
womenStd =   (3, 5, 2, 3, 3)
rects2 = ax.bar(ind+width, womenMeans, width, color='y', yerr=womenStd)

# add some
ax.set_ylabel('Scores')
ax.set_title('Scores by group and gender')
ax.set_xticks(ind+width)
ax.set_xticklabels( ('G1', 'G2', 'G3', 'G4', 'G5') )

ax.legend( (rects1[0], rects2[0]), ('Men', 'Women') )

def autolabel(rects):
    # attach some text labels
    for rect in rects:
        height = rect.get_height()
        ax.text(rect.get_x()+rect.get_width()/2., 1.05*height, '%d'%int(height),
                ha='center', va='bottom')

autolabel(rects1)
autolabel(rects2)

plt.show()
  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值