由于freetype,在OS X 10.11上将matplotlib升级到1.5会失败

时间:2015-12-14 13:53:36

标签: python matplotlib freetype

一个简单的

sudo pip install matplotlib --upgrade

失败并显示以下日志:

Downloading/unpacking matplotlib from https://pypi.python.org/packages/source/m/matplotlib/matplotlib-1.5.0.tar.gz#md5=7952a539418ed77432aa4727409f24cf
  Running setup.py egg_info for package matplotlib
    ============================================================================
    Edit setup.cfg to change the build options

    BUILDING MATPLOTLIB
                matplotlib: yes [1.5.0]
                    python: yes [2.7.3 |EPD 7.3-2 (64-bit)| (default, Apr 12
                            2012, 11:14:05)  [GCC 4.0.1 (Apple Inc. build
                            5493)]]
                  platform: yes [darwin]

    REQUIRED DEPENDENCIES AND EXTENSIONS
                     numpy: yes [version 1.10.1]
                  dateutil: yes [using dateutil version 2.4.2]
                      pytz: yes [using pytz version 2015.7]
                    cycler: yes [cycler was not found. pip will attempt to
                            install it after matplotlib.]
                   tornado: yes [using tornado version 2.2]
                 pyparsing: yes [Your pyparsing contains a bug that will be
                            monkey-patched by matplotlib.  For best results,
                            upgrade to pyparsing 2.0.1 or later.]
                    libagg: yes [pkg-config information for 'libagg' could not
                            be found. Using local copy.]
                  freetype: no  [The C/C++ header for freetype2 (ft2build.h)
                            could not be found.  You may need to install the
                            development package.]
                       png: yes [version 1.6.18]
                     qhull: yes [pkg-config information for 'qhull' could not be
                            found. Using local copy.]

    OPTIONAL SUBPACKAGES
               sample_data: yes [installing]
                  toolkits: yes [installing]
                     tests: yes [using nose version 1.1.2 / mock is required to
                            run the matplotlib test suite. "setup.py test" will
                            automatically download it. Install mock to run
                            matplotlib.test()]
            toolkits_tests: yes [using nose version 1.1.2 / mock is required to
                            run the matplotlib test suite. "setup.py test" will
                            automatically download it. Install mock to run
                            matplotlib.test()]

    OPTIONAL BACKEND EXTENSIONS
                    macosx: yes [installing, darwin]
                    qt5agg: no  [PyQt5 not found]
                    qt4agg: yes [installing, Qt: 4.7.3, PySide: 1.1.0; PyQt4 not
                            found]
                   gtk3agg: no  [Requires pygobject to be installed.]
                 gtk3cairo: no  [Requires cairocffi or pycairo to be installed.]
                    gtkagg: no  [Requires pygtk]
                     tkagg: yes [installing, version 81008]
                     wxagg: no  [requires wxPython]
                       gtk: no  [Requires pygtk]
                       agg: yes [installing]
                     cairo: no  [cairocffi or pycairo not found]
                 windowing: no  [Microsoft Windows only]

    OPTIONAL LATEX DEPENDENCIES
                    dvipng: no
               ghostscript: yes [version 9.16]
                     latex: no
                   pdftops: no

    OPTIONAL PACKAGE DATA
                      dlls: no  [skipping due to configuration]

    ============================================================================
                            * The following required packages can not be built:
                            * freetype
    Complete output from command python setup.py egg_info:
    ============================================================================

Edit setup.cfg to change the build options



BUILDING MATPLOTLIB

            matplotlib: yes [1.5.0]

                python: yes [2.7.3 |EPD 7.3-2 (64-bit)| (default, Apr 12

                        2012, 11:14:05)  [GCC 4.0.1 (Apple Inc. build

                        5493)]]

              platform: yes [darwin]



REQUIRED DEPENDENCIES AND EXTENSIONS

                 numpy: yes [version 1.10.1]

              dateutil: yes [using dateutil version 2.4.2]

                  pytz: yes [using pytz version 2015.7]

                cycler: yes [cycler was not found. pip will attempt to

                        install it after matplotlib.]

               tornado: yes [using tornado version 2.2]

             pyparsing: yes [Your pyparsing contains a bug that will be

                        monkey-patched by matplotlib.  For best results,

                        upgrade to pyparsing 2.0.1 or later.]

                libagg: yes [pkg-config information for 'libagg' could not

                        be found. Using local copy.]

              freetype: no  [The C/C++ header for freetype2 (ft2build.h)

                        could not be found.  You may need to install the

                        development package.]

                   png: yes [version 1.6.18]

                 qhull: yes [pkg-config information for 'qhull' could not be

                        found. Using local copy.]



OPTIONAL SUBPACKAGES

           sample_data: yes [installing]

              toolkits: yes [installing]

                 tests: yes [using nose version 1.1.2 / mock is required to

                        run the matplotlib test suite. "setup.py test" will

                        automatically download it. Install mock to run

                        matplotlib.test()]

        toolkits_tests: yes [using nose version 1.1.2 / mock is required to

                        run the matplotlib test suite. "setup.py test" will

                        automatically download it. Install mock to run

                        matplotlib.test()]



OPTIONAL BACKEND EXTENSIONS

                macosx: yes [installing, darwin]

                qt5agg: no  [PyQt5 not found]

                qt4agg: yes [installing, Qt: 4.7.3, PySide: 1.1.0; PyQt4 not

                        found]

               gtk3agg: no  [Requires pygobject to be installed.]

             gtk3cairo: no  [Requires cairocffi or pycairo to be installed.]

                gtkagg: no  [Requires pygtk]

                 tkagg: yes [installing, version 81008]

                 wxagg: no  [requires wxPython]

                   gtk: no  [Requires pygtk]

                   agg: yes [installing]

                 cairo: no  [cairocffi or pycairo not found]

             windowing: no  [Microsoft Windows only]



OPTIONAL LATEX DEPENDENCIES

                dvipng: no

           ghostscript: yes [version 9.16]

                 latex: no

               pdftops: no



OPTIONAL PACKAGE DATA

                  dlls: no  [skipping due to configuration]



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

                        * The following required packages can not be built:

                        * freetype

----------------------------------------
Command python setup.py egg_info failed with error code 1 in /tmp/pip-build/matplotlib
Storing complete log in /Users/vlad-arisolteanu/.pip/pip.log

同时,

brew install freetype

返回:

Warning: freetype-2.6_1 already installed

所以看起来我的系统上安装了freetype。那么发生了什么?令人失望的是像matplotlib这样的关键Python包没有安装。

任何帮助将不胜感激。

3 个答案:

答案 0 :(得分:2)

由于您正在使用Enthought,因此建议安装matplotlib之类的东西的方法是安装Canopy Express,它是Enthought发行版的免费附加组件,它还允许您访问~100个可以使用的软件包很容易安装到Enthought。

您尝试使用brew做什么,并且这样做不适用于Enthought开箱即用,并且需要您设置正确的环境变量和构建设置,因为整个系统不了解{ {1}}存在。

答案 1 :(得分:1)

您可能需要安装pkg-config。尝试:

brew install pkg-config

在安装matplotlib之前。

有关此问题的更多讨论,请参阅here。听起来matplotlibfreetype的路径感到困惑,但pkg-config会覆盖此路径并设置正确的路径。还有matplotlib自述文件here,表明您需要pkg-config

答案 2 :(得分:0)

我正在使用matplotlib,OSX 10.11,Python 3.6和matplotlib 1.5.1

make virtualenv(在一个没有空格的路径中) 我已经安装了python 3,我发现没有安装符号链接,所以我跟着symlink到python3.6文件并使用它。使用virtualenv -p命令。

我默认安装了xquartz默认不在osx的内容,matplotlib仍然无法安装。也就是说,直到我发现matplotlib安装内容在/include/ft2buid.h而不在/include/freetype2/ft2build.h中,因此我在库中设置了符号链接到/freetype2/ft2build.h文件,然后运行了pip安装matplotlib,它工作

Python未作为框架安装......

我尝试将这个名为framework python的文件重新路由到python或其他东西但是没有用 最后我找到了一张说明去文件夹的说明:

~/.matplotlib(逐字地将其粘贴到文件夹对话框中) 然后创建一个名为matplotlibrc的纯文本文件(没有文件扩展名),只有文本: 后端:TkAgg

这就是我所谓的伏都教,现在matplotlib的雨演示工作

这个特定的问题可能只需要一个符号链接,我给了自己更多的virtualenv复杂性,但我记不起来了。