安装Numpy和matplotlib
(1)测试程序
这是我从网上(http://www.open-open.com/lib/view/open1393488232380.html)找到的一个使用Numpy和matplotlib的示例程序,我用这段代码来测试Numpy和matplotlib安装是否成功。
import numpy as np
import matplotlib.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()
(2)在Windows上安装
在Windows上安装Numpy和matplotlib是一个和痛苦的过程。总体来说,安装这两个包的官方安装程序是远远不够的。总会提示你缺这个缺那个。我的解决办法接单粗暴,提示缺少什么了我就谷歌然后安装这个包。所有的包都可以从这个网站(http://www.lfd.uci.edu/~gohlke/pythonlibs/)找得到。
最后为了安装Nump和matplotlib,我一共安装了6个包:
- matplotlib-1.4.2.win-amd64-py2.7
- numpy-MKL-1.9.1.win-amd64-py2.7
- pyparsing-2.0.3.win-amd64-py2.7
- python-dateutil-2.2.win-amd64-py2.7
- scipy-0.15.0b1.win-amd64-py2.7
- six-1.8.0.win-amd64-py2.7
(3)在Ubuntu上安装
相比在Windows上安装软件,在Ubuntu上安装就简单多了,一句命令搞定:
1: sudo apt-get install python-numpy python-matplotlib
所有依赖的包都自动安装上了,给个赞!
真心说一句,Ubuntu除了网络问题不给力之外,装软件真心是很赞的!
安装Numpy和matplotlib的更多相关文章
- win7系统下python安装numpy,matplotlib,scipy和scikit-learn
1.安装numpy,matplotlib,scipy和scikit-learn win7系统下直接采用pip或者下载源文件进行安装numpy,matplotlib,scipy时会遇到各种问题,这是因为 ...
- ubuntu下安装numpy和matplotlib
安装NumPy函数库--sudo apt-get install python-numpy 以及 sudo apt-get install python-scipy NumPy函数库的函数查看:Nu ...
- win7 64+python2.7.12安装numpy+scipy+matplotlib+scikit-learn
python包下载网址 http://www.lfd.uci.edu/~gohlke/pythonlibs/ 1.已经安装python2.7.12,查看scripts里是否有pip.2.7.9版本以上 ...
- 在Ubuntu 14.04 64bit上安装numpy和matplotlib库
原文:http://blog.csdn.net/tao_627/article/details/44004541 按照这个成功安装! 机器学习是数据挖掘的一种实现形式,在学习<机器学习实战> ...
- Linux入门(10)——Ubuntu16.04使用pip3和pip安装numpy,scipy,matplotlib等第三方库
安装Python3第三方库numpy,scipy,matplotlib: sudo apt install python3-pip pip3 install numpy pip3 install sc ...
- Python安装Numpy,matplotlib库
<1> Numpy是一款基于python的功能强大的科学计算包.要安装numpy首先你得先安装python. python的安装非常简单,本人安装的是python2.7 具体安装步骤如下: ...
- Python 安装 numpy 以及 matplotlib 的过程
系统:ubuntu 16.04 版本:Python3.5 步骤: 安装 pip sudo apt install python3-pip 查看 pip list 是否有 numpy 以及 matplo ...
- mac安装numpy,scipy,matplotlib
SaintKings-Mac-mini:~ saintking$ python Python ( , ::) [GCC Compatible Apple LLVM (clang-)] on dar ...
- 安装numpy、matplotlib
一.安装numpy 1.下载 https://pypi.org/project/numpy/#files 2.安装 pip3 install numpy-1.17.3-cp37-cp37m-win_a ...
随机推荐
- android中setOnClickListener的那点事
最近在写代码中,发现在xml文件设置了android:clickable="false",之后这个View还是可点的. 后来发现,是代码中对View设置了监听事件(setOnCli ...
- 第十三章、学习 Shell Scripts 简单的 shell script 练习
简单的 shell script 练习 简单范例 对谈式脚本:变量内容由使用者决定 [root@www scripts]# vi sh02.sh #!/bin/bash # Program: # Us ...
- 如何自己动手实现 KVO(转)
KVO (Key-Value Observing) KVO 是 Objective-C 对观察者模式(Observer Pattern)的实现.也是 Cocoa Binding 的基础.当被观察对象的 ...
- AVR抗干扰能力一般
在485通信中,为了方便测试,在485 芯片前端加下了插测好测试量,可是用TTL直接通信, 但是,在实际的PCB测试中,9600 的波特率下不小心用手碰了P5插针,会现大量的数量错误, 后来在Tx和R ...
- poj 4045 (树形DP)
先选一点为根节点找出所有父节点i到下面所有点距离和dp[i],该父节点下面有多少个点Node[i]. 然后求出所有节点的所有非子节点到该点的距离dp1[v]+=(dp1[u]+(dp[u]-dp[v] ...
- [struts2]jstl标签用法技巧
1.<c:if test="${var} != null"></c:if> 2. <c:foreach var="singleVar&quo ...
- 如何检查机器是否因为装了Windows更新而需要重新启动
博客搬到了fresky.github.io - Dawei XU,请各位看官挪步.最新的一篇是:如何检查机器是否因为装了Windows更新而需要重新启动.
- MapReduce的流程
1. Inputformat会从job的INPUT_DIR目录下读入待处理的文件,检查输入的有效性并将文件切分成InputSplit列表.Job实例可以通过setInputFormatClass(Cl ...
- 剑指OFFER之树的子结构(九度OJ1520)
题目描述: 输入两颗二叉树A,B,判断B是不是A的子结构. 输入: 输入可能包含多个测试样例,输入以EOF结束.对于每个测试案例,输入的第一行一个整数n,m(1<=n<=1000,1< ...
- 升级SUSE Linux内核的完整步骤!
http://blog.sina.com.cn/s/blog_491529d60100061h.html 安装完SLED 10后发现仍然有“热启动网络不通”的问题,原因是内核版本较低,于是升级到2.6 ...