在安装ubuntu安装matplotlib时碰到不少问题,简单做个备忘:

需要先安装其依赖的包libpng和freetype

安装libpng:

sudo apt-get install libpng-dev

安装freetype:

cd ~/Downloads

wget https://download.savannah.gnu.org/releases/freetype/freetype-2.4.10.tar.gz

tar zxvf freetype-2.4.10.tar.gz

cd freetype-2.4.10/

./congfigure

make

sudo make install

安装pip,然后通过pip来安装matplotlib:

sudo apt-get install python-pip

安装好pip后就可以用下面的命令来查找matplotlib和查看其安装状态

sudo pip search matplotlib

安装matplotlib

sudo pip install matplotlib

1.no module named configparser

pip install configparser

或 sudo aptitude install python-configparser

出现这个问题的原因是python3中并没有ConfigParser这个模块,为了遵循pep 8的标准,已经改名为configparser了。

通过报错可以看到出问题的文件在哪里,我们切换到该文件所在文件夹,我的是/usr/bin/。如果通过一般的思维,即把该文件中的语法转化为python3,那么可以解决这个问题,但是又会报出其它错误,可以照错误提示一直把全部相关文件和模块改为python3的语法,但是工作量很繁琐。

另外一种方法:通过ls我们可以看到有个文件叫做pycompile,还有个文件叫做py3compile,前者遵循的是python2的语法,而我们使用pip的时候使用的就是pycompile,我们只需要用py3compile中的内容覆盖pycompile中的内容,这样的话就解决这个问题了

备注:以上是我在使用ubuntu16.04安装和使用pip发现的问题,ubuntu16.04测试成功

2. fatal error: Python.h: No such file or directory

For Python version 2.x+

$ sudo apt-get install python-dev

OR
# apt-get install python-dev
For Python version 3.x+

$ sudo apt-get install python3-dev

OR
# apt-get install python3-dev

注意在实际画图中仍然可能出错,错误是“NotImplementedError: Surface.create_for_data: Not Implemented yet.”

可以通过安装cairocffi解决。

sudo pip3 install cairocffi。

安装cairocffi也会碰到错误,可以尝试:

sudo apt-get install python3-dev
sudo apt-get install libffi-dev
sudo pip3 install cffi
sudo pip3 install cairocffi 或
pip install cairocffi==0.6
 

ubuntu16 安装matplotlib的更多相关文章

  1. Ubuntu 安装 matplotlib

    参考: ubuntu16 安装matplotlib Ubuntu 安装 matplotlib sudo apt-get install libpng-dev libfreetype6-dev pkg- ...

  2. ubuntu安装matplotlib一些坑

    ubuntu16.04,python2.7 安装matplotlib, 1.在root权限下执行命令 pip install matplotlib==1.5.1 这里有个困扰我一个星期的问题,系统都被 ...

  3. uwsgi+flask环境中安装matplotlib

    uwsgi+flask的python有自身的virtual environment,可以通过如下命令进入 . venv/bin/activate 虽然通过sudo apt-get install py ...

  4. Python 安装matplotlib,six,dateutil,pyparsing 完整过程

    [摘要:正在做词频剖析的时间,须要用matlotlib 做图表,柱状图啥的,因而便最先了一个又一个的装置库的进程 由于matplotlib 须要依附很多其他科教盘算的第三圆库,须要一个一个的装置了.. ...

  5. Ubuntu10.04 python2.6下安装matplotlib环境

    一.准备工作1.sudo apt-get install python-numpy2.sudo apt-get install python2.6-dev3.sudo apt-get install ...

  6. 为python安装matplotlib模块

    matplotlib是python中强大的画图模块. 首先确保已经安装python,然后用pip来安装matplotlib模块. 进入到cmd窗口下,执行python -m pip install - ...

  7. Python3.x(windows系统)安装matplotlib库

    Python3.x(windows系统)安装matplotlib库 cmd命令: pip install matplotlib 执行结果:

  8. 安装matplotlib

    1.1 Linux中安装matplotlib 如果使用的系统自带的python版本,可使用系统的包管理器安装matplotlib,命令如下: $ sudo apt-get install python ...

  9. 在tensorflow环境下安装matplotlib

    在运行程序时,报错ImportError: No module named 'matplotlib',如图.经网上查询发现是没有安装matplotlib 因此记录一下在tensorflow环境下安装m ...

随机推荐

  1. mysql创建用户并授予权限

    MySQL创建数据库与创建用户以及授权   1.create schema [数据库名称] default character set utf8 collate utf8_general_ci;--创 ...

  2. SQL注入之Sqli-labs系列第七篇(基于root权限读写注入)

    开始挑战第一关(Error Based- String) 开始之前,先介绍这关需要用到的几个函数,如下图 继续访问我们的地址,输入' “ 一些测试语句发现都没有反应 查看源码,是采用了单引号和双括号 ...

  3. [转]skynet Lua中的协程

    Lua中的协程 http://www.outsky.org/code/lua-coroutine.html Sep 6, 2014 Lua中的协程和其他变量一样,都是第一类值(first-class ...

  4. django配置Ueditor富文本编辑器

    1.https://github.com/twz915/DjangoUeditor3下载包,进入包文件夹,找到DjangoUeditor包拷贝到项目下,和xadmin同级目录 2.找到项目的setti ...

  5. Xposed MultiDex Hook

    使用Xposed Hook多DEX的应用时,Xposed会抛ClassNotFound的异常,原因是它只会在classes.dex查找类.以下官方不完美解决办法,参考 Github上的 #30 iss ...

  6. Mysql安装和基本使用

    MySQL的介绍安装.启动 windows上制作服务 MySQL破解密码 MySQL中统一字符编码 MySQL MySQL是一个关系型数据库管理系统,由瑞典MySQL AB 公司开发,目前属于 Ora ...

  7. Linux内存压力测试stressapptest

    /********************************************************************** * Linux内存压力测试stressapptest * ...

  8. Vim 文件coding gbk格式

    只需在 ~/.vimrc设置一致即可.文件编辑可正常显示中文,cat,不能正常显示,显示乱码,详情参考上篇. set fileencodings=utf-8,ucs-bom,gb18030,gbk,g ...

  9. NOI-1.1-10-字符表示超级玛丽

    10:超级玛丽游戏   总时间限制:  1000ms 内存限制:  65536kB 描述 超级玛丽是一个非常经典的游戏.请你用字符画的形式输出超级玛丽中的一个场景. 输入 无. 输出 如样例所示. 样 ...

  10. mac上不了网

    不知怎么回事勾选了socks代理导致ping的通但打不开网页软件登不了