[Module]matplotlib模块安装

简述

python code中有import matplotlib,但是使用的Ubuntu 16.04 64bit上的python3.5没有这个module,需要进行安装。

安装

使用如下命令开始安装:

pip3 install matplotlib

发现提示如下:

freetype: no  [The C/C++ header for freetype2 (ft2build.h) could not be found.  You may need to install the development package.]
png: no  [pkg-config information for 'libpng' could not be found.]

* The following required packages can not be built:
                            * freetype, png

说明缺少依赖的包freetype和libpng。

安装libpng

使用如下命令:

sudo apt-get install libpng-dev

安装freetype

cd ~/Downloads
wget http://download.savannah.gnu.org/releases/freetype/freetype-2.6.5.tar.gz
tar -zxvf freetype-2.6.5.tar.gz
cd freetype-2.6.5/
./congfigure
sudo make
sudo make install

继续安装matplotlib

再用命令:

sudo pip3 install matplotlib

发现终端卡住了……
需要耐心等待,过了十来分钟后,看到pip还安装了其他的缺少的东西,并将matplotlib安装完成:
[Module]matplotlib模块安装_第1张图片

你可能感兴趣的:(Lang-Python)