安装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 ...
随机推荐
- BNUOJ-26480 Horror List 最短路
题目链接:http://www.bnuoj.com/bnuoj/problem_show.php?pid=26480 题意:简单来说,就是给一个图,然后从每个honor list中的点求最短路.. 边 ...
- linux shell-syntax error near unexpected token错误
在windows下用记事本编写linux shell脚本后,执行遇到syntax error near unexpected token错误 问题原理:网上找了好久,找到原因,原来是回行的问题,每个系 ...
- adb不响应
1.CMD命令窗口输入:adb nodaemon server .然后就会提示你哪个端口被占用了. 2.输入netstat -ano | findstr "5037" .然后会弹出 ...
- 如何让Iconfont作用到content伪类中
沿用同行思密达的方法整理了一下;前提是先引入iconfont字体图标(引用线上iconfont查看上篇随笔):比如 其中&#是开头用以标明这是字符实体,x表示这是十六进制,而CSS的cont ...
- Packetbeat协议扩展开发教程(2)
原文链接:http://elasticsearch.cn/article/53 书接上回:http://elasticsearch.cn/article/48 我们打开Packetbeat项目,看看里 ...
- uml 在需求分析阶段的应用
上一篇博客写了uml在软件开发过程中的应用,这以篇要详细介绍一下UML在需求分析过程中的应用. 以机房收费系统为例进行讲解,先介绍一个该系统. 首先该系统的用户分为三个等级,一般用户,操作员,管理员, ...
- JavaScript要点 (一) 变量-作用域
JavaScript 作用域 作用域—可访问变量的集合. 全局变量或者函数可以覆盖window对象的变量或者函数: 局部变量和window对象可以覆盖全局变量和函数. JavaScript 作用域 在 ...
- vs2005升级到vs2010相关问题
1.项目编译失败,报 Resgen.exe 退出 ,错误代码2 处理方式: http://jingyan.baidu.com/article/90895e0fe80c6064ed6b0b6b.html ...
- Android的横竖屏切换
android的横竖屏切换,也会发生不少问题. 1. 锁定屏幕方向,禁止切换: 在AndroidManifest.xml中的Activity参数中加上 android:screenOrientat ...
- POJ 3080 Blue Jeans (KMP)
求出公共子序列 要求最长 字典序最小 枚举第一串的所有子串 然后对每一个串做KMP.找到目标子串 学会了 strncpy函数的使用 我已可入灵魂 #include <iostre ...