ubuntu16 安装matplotlib
在安装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的更多相关文章
- Ubuntu 安装 matplotlib
参考: ubuntu16 安装matplotlib Ubuntu 安装 matplotlib sudo apt-get install libpng-dev libfreetype6-dev pkg- ...
- ubuntu安装matplotlib一些坑
ubuntu16.04,python2.7 安装matplotlib, 1.在root权限下执行命令 pip install matplotlib==1.5.1 这里有个困扰我一个星期的问题,系统都被 ...
- uwsgi+flask环境中安装matplotlib
uwsgi+flask的python有自身的virtual environment,可以通过如下命令进入 . venv/bin/activate 虽然通过sudo apt-get install py ...
- Python 安装matplotlib,six,dateutil,pyparsing 完整过程
[摘要:正在做词频剖析的时间,须要用matlotlib 做图表,柱状图啥的,因而便最先了一个又一个的装置库的进程 由于matplotlib 须要依附很多其他科教盘算的第三圆库,须要一个一个的装置了.. ...
- Ubuntu10.04 python2.6下安装matplotlib环境
一.准备工作1.sudo apt-get install python-numpy2.sudo apt-get install python2.6-dev3.sudo apt-get install ...
- 为python安装matplotlib模块
matplotlib是python中强大的画图模块. 首先确保已经安装python,然后用pip来安装matplotlib模块. 进入到cmd窗口下,执行python -m pip install - ...
- Python3.x(windows系统)安装matplotlib库
Python3.x(windows系统)安装matplotlib库 cmd命令: pip install matplotlib 执行结果:
- 安装matplotlib
1.1 Linux中安装matplotlib 如果使用的系统自带的python版本,可使用系统的包管理器安装matplotlib,命令如下: $ sudo apt-get install python ...
- 在tensorflow环境下安装matplotlib
在运行程序时,报错ImportError: No module named 'matplotlib',如图.经网上查询发现是没有安装matplotlib 因此记录一下在tensorflow环境下安装m ...
随机推荐
- 解决java.lang.NoClassDefFoundError: org/aopalliance/intercept/MethodInterceptor问题
hibernate整合spring当在spring配置文件中加入如下代码 <!--2.配置事务属性,需要事务管理器--> <tx:advice id="txAdvice&q ...
- SAP Module Pool Program Learning Documentation——Commit Work and Update dtab
When using Native SQL to directly manipulate database tables, it makes a difference to use COMMIT WO ...
- Codeforce 9C - Hexadecimal's Numbers
One beautiful July morning a terrible thing happened in Mainframe: a mean virus Megabyte somehow got ...
- LexAndYacc 安装程序
在ubuntu 下面执行 sudo apt-get install byacc flex bison
- youtube-dl 使用小记
0.官网地址 youtube-dl官网:https://yt-dl.org/项目地址:https://github.com/rg3/youtube-dl 1.文档简略翻译,具体请以官方文档为准 Usa ...
- Cython 使用
链接: Cython是一个快速生成Python扩展模块的工具,从语法层面上来讲是Python语法和C语言语法的混血,当Python性能遇到瓶颈时,Cython直接将C的原生速度植入Python程序,这 ...
- Unity 3D调用Windows打开、保存窗口、文件浏览器
Unity调用Window窗口 本文提供全流程,中文翻译. Chinar 坚持将简单的生活方式,带给世人!(拥有更好的阅读体验 -- 高分辨率用户请根据需求调整网页缩放比例) Chinar -- 心分 ...
- matlab数组和矩阵
数组创建 要创建每行包含四个元素的数组,请使用逗号 (,) 或空格分隔各元素. a = [1 2 3 4] a = 1×4 1 2 3 4 这种数组为行向量. 要创建包含多行的矩阵,请使用分号分隔各行 ...
- Java设计模式(一)
1.什么是设计模式? 在软件工程中,设计模式是对软件设计中普遍存在的各种问题,所提出的 解决方案. 换句话说,设计模式是一套被反复使用.多数人知晓的.经过分类的.代码设计的 经验的总结.使用设计模式是 ...
- POJ3090 Visible Lattice Points (数论:欧拉函数模板)
题目链接:传送门 思路: 所有gcd(x, y) = 1的数对都满足题意,然后还有(1, 0) 和 (0, 1). #include <iostream> #include <cst ...