无法在ubuntu 14.04上将matplotlib升级到1.4.3

时间:2015-08-14 16:37:30

标签: python-2.7 matplotlib ubuntu-14.04

我尝试使用以下命令升级matplotlib:

$export PYTHONHOME=/usr/lib/python2.7/

$sudo easy_install -U distribute

$sudo pip install --upgrade matplotlib

但他们都没有奏效。它在下载matplotlib 1.4.3软件包但未安装后显示错误。

任何人都可以帮助正确升级吗?

1 个答案:

答案 0 :(得分:3)

你得到的错误说明了这一点。

============================================================================

                    * The following required packages can not be built:

                    * freetype, png

----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /tmp/pip_build_root/matplotlib
Storing debug log for failure in /home/snapey/.pip/pip.log

如果你进一步观察,它会说

REQUIRED DEPENDENCIES AND EXTENSIONS:

... <Some other packages, all present>

              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.]

所以,它告诉你问题 - freetypepng不存在且无法构建

要纠正这个问题 - 安装它们如下:

sudo apt-get install libfreetype6-dev libpng12-dev

This is almost a duplicate question,但看起来问题是Python 3特定的(它不是)。

我发现我必须运行pip install --upgrade matplotlib两次,因为它第一次出现了关于python.h的错误,但后来我有了matplotlib 1.4.3。测试了Ubuntu 14.04 64位,python 2.7

顺便说一下 - 这真的很丑陋,应该用Ubuntu和/或matplotlib开发人员来提升。