Ubuntu下安装Numpy, SciPy and Matplotlib
Python开发环境包含科学计算,需要安装NumPy, SciPy, Matplotlib。其中Matplotlib依赖于Python和NumPy。我们先安装NumPY和SciPy. Matplotlib安装稍微复杂
1.首先确保你的apt-get可用。如果不可用 试着更新一下
sudo apt-get install
2.安装你的NumPy和SciPy.
apt-get install python-numpy
apt-get install python-scipy
3.安装你的Matplotlib
安装Matplotlib前需要先安装其依赖的包libpng和freetype
安装libpng:
sudo apt-get install libpng-dev
安装freetype:
首先需要从网上下载freetype文件:http://download.savannah.gnu.org/releases/freetype/freetype-2.4.10.tar.gz
下载成功后可以选择安装地址(笔者安装在 /usr/local/freetype 下)
sudo mkdir /usr/local/freetype
sudo cp freetype-2.4..tar.gz /usr/local/freetype
sudo tar zxvf freetype-2.4..tar.gz
sudo cd freetype-2.4./
sudo ./congfigure
sudo make
sudo make install
如果在执行sudo mke install时出现错误
rm -f /usr/local/modules/freetype/include/freetype2/freetype/cache/*
rmdir /usr/local/modules/freetype/include/freetype2/freetype/cache
rm -f /usr/local/modules/freetype/include/freetype2/freetype/internal/*
rmdir /usr/local/modules/freetype/include/freetype2/freetype/internal
rmdir: ‘/usr/local/modules/freetype/include/freetype2/freetype/internal’: 没有那个文件或目录
make: [install] 错误 1 (忽略)
/usr/bin/install -c -m 644 ./builds/unix/ft2unix.h \
/usr/local/modules/freetype/include/ft2build.h
/usr/bin/install -c -m 644 ./builds/unix/ftconfig.h \
/usr/local/modules/freetype/include/freetype2/freetype/config/ftconfig.h
/usr/bin/install -c -m 644 /opt/src/lamp/freetype-2.2.1/objs/ftmodule.h \
/usr/local/modules/freetype/include/freetype2/freetype/config/ftmodule.h
/usr/bin/install -c -m 755 ./builds/unix/freetype-config \
/usr/local/modules/freetype/bin/freetype-config
/usr/bin/install -c -m 644 ./builds/unix/freetype2.m4 \
/usr/local/modules/freetype/share/aclocal/freetype2.m4
/usr/bin/install -c -m 644 ./builds/unix/freetype2.pc \
/usr/local/modules/freetype/lib/pkgconfig/freetype2.pc
注意上面的黑体字“rmdir: ‘/usr/local/modules/freetype/include/freetype2/freetype/internal’: 没有那个文件或目录 make: [install] 错误 1 (忽略)” (不同用户可能又不同路径)
解决方法:
sudo mkdir rmdir: /usr/local/modules/freetype/include/freetype2/freetype/internal
之后重新尝试sudo make install方法。
安装pip,然后通过pip来安装matplotlib:
sudo apt-get install python-pip
安装好pip后就可以用下面的命令来查找matplotlib和查看其安装状态
sudo pip search matplotlib
安装matplotlib
sudo pip install matplotlib
OK现在来检验一下
eric@eric-Lenovo-Y50-:~$ python
Python 2.7. (default, Jun , ::)
[GCC 4.8.] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from numpy import *
>>> random.rand(,)
array([[ 0.9615149 , 0.8125032 , 0.39732582, 0.31623145],
[ 0.72705913, 0.58407689, 0.81894134, 0.78653881],
[ 0.20863496, 0.08460187, 0.35620451, 0.49642794],
[ 0.34755404, 0.366561 , 0.2603963 , 0.85014281]])
>>> exit()
eric@eric-Lenovo-Y50-:~$
注意random.ran(4,4)为随机生成一个4×4数组,数组元素为随机数
Ubuntu下安装Numpy, SciPy and Matplotlib的更多相关文章
- Ubuntu Python 安装numpy SciPy、MatPlotLib环境
安装 sudo apt-get install python-scipysudo apt-get install python-numpysudo apt-get install python-mat ...
- Windows10+Python3下安装NumPy+SciPy+Matplotlib
Numpy.SciPy.MatplotLib是Python下从事科学计算必不可少的库.我在用其他的方法安装时出现各种问题,发现直接安装.whl包是最快且不报错的方法. 1.下载.whl包在下面的网站中 ...
- ubuntu下安装numpy和matplotlib
安装NumPy函数库--sudo apt-get install python-numpy 以及 sudo apt-get install python-scipy NumPy函数库的函数查看:Nu ...
- Ubuntu下安装Python绘图库Matplotlib的方法
在安装好Python的基础上, sudo apt-get install python-numpy sudo apt-get install python-scipy sudo apt-get ins ...
- ubuntu python 安装numpy,scipy.pandas.....
http://blog.csdn.net/Yakumoyukarilan/article/details/51340358
- Ubuntu下安装python相关数据处理
01. Ubuntu下安装ipython sudo apt-get install ipython 02. Ubuntu下安装pip $ sudo apt-get install python-pip ...
- windows下安装python科学计算环境,numpy scipy scikit ,matplotlib等
安装matplotlib: pip install matplotlib 背景: 目的:要用Python下的DBSCAN聚类算法. scikit-learn 是一个基于SciPy和Numpy的开源机器 ...
- Windows系统在Python2.7环境下安装numpy, matplotlib, scipy - Lichanghao Blog
numpy, matplotlib, scipy三个包是科学计算和绘图的利器.安装它们既可以在网上下载exe安装包,也可以用python内置的包管理工具来下载安装,后者较为方便. 这几天做美赛要用到, ...
- centos 7 下安装numpy、scipy等python包
本文适用于刚入门的小白,欢迎大牛们批评指正. 因为要开始数据分析,而python又不像R和matlab那么简洁.需要安装的包很多~ 网上找了好多牛人博客,想在centos7下安装numpy,scipy ...
随机推荐
- MyBabis 用法详解
MyBatis 一个支持普通SQL查询,存储过程和高级映射的优秀持久层框架(消除了几乎所以得JDBC代码和参数的手工设置及结果集的检索) MyBatis可以使用简单的XML或注解用于配置和原始映射,将 ...
- 【CentOS】虚拟机网络配置与远程登录
////////////////////////////////////11月16日更新////////////////////////////////////////////////////// 一 ...
- Android常用元件
本文来源于 http://blog.csdn.net/wxhlinux/article/details/8601170#comments 1.4 Android應用程式元件1.4.1 Activi ...
- 2015年ACM长春网络赛(准备做掉7道:已经更新到6道)
总结汇总:模板 int getmax_min(char s[]) {//字符串的最大表示法:返回最小数组下标 , j = , k = ; while(i < len && j & ...
- MySQL 分组后,统计记录条数
分组后,统计记录条数: SELECT num,count(*) AS counts from test_a GROUP BY num; 查询结果如下: 对num去重后的数量的统计: SELECT co ...
- linux设备驱动
http://blog.csdn.net/bob_fly1984/article/details/8820670 struct ov5640_data { struct ov5640_platf ...
- Self-introduction (自我介绍)
* 姓名,本名不想这样就暴露,Rachel我英文名,不愿意叫算了,直接叫我米蟲就好了. * 性格, 偏执一些,表里不一,表面和善,骨子倔强,我这一生都在追求高逼格,从未间断过 偶尔像个小疯子,有 ...
- javascript学习之运动框架
模仿新浪博客首页的,最新评论: <!DOCTYPE HTML> <html> <head> <meta charset="utf-8"&g ...
- Windows 7 常用快捷键
常用的快捷键 Win键+D 回到桌面/当前界面(切换)Win键+M 回到桌面Win键+E 资源管理器Win键+R 运行 Win键+U 控制面板->所有控制面板项->轻松访问中心 Win键+ ...
- swfit-扩展语法
import UIKit extension Double { var km: Double { } var m : Double { return self} var cm: Double { re ...