在OSX上安装matplotlib时出错

时间:2016-01-24 15:41:07

标签: python pandas matplotlib

我试图为熊猫设置绘图功能,我跟着这个:

http://matplotlib.org/faq/installing_faq.html

当我尝试安装时,我收到有关freetype未安装的错误消息。但是,它已经安装:

$ brew install freetype
Warning: freetype-2.6_1 already installed

完整安装日志

$ easy_install -m matplotlib
Searching for matplotlib
Reading https://pypi.python.org/simple/matplotlib/
Best match: matplotlib 1.5.1
Downloading https://pypi.python.org/packages/source/m/matplotlib/matplotlib-1.5.1.tar.gz#md5=f51847d8692cb63df64cd0bd0304fd20
Processing matplotlib-1.5.1.tar.gz
Writing /var/folders/m9/4wkz8drj1dg9pddn916_pdqw0000gn/T/easy_install-XQNDr1/matplotlib-1.5.1/setup.cfg
Running matplotlib-1.5.1/setup.py -q bdist_egg --dist-dir /var/folders/m9/4wkz8drj1dg9pddn916_pdqw0000gn/T/easy_install-XQNDr1/matplotlib-1.5.1/egg-dist-tmp-KGl8Xp
IMPORTANT WARNING:
    pkg-config is not installed.
    matplotlib may not be able to find some of its dependencies
============================================================================
Edit setup.cfg to change the build options

BUILDING MATPLOTLIB
            matplotlib: yes [1.5.1]
                python: yes [2.7.10 (default, Oct 23 2015, 18:05:06)  [GCC
                        4.2.1 Compatible Apple LLVM 7.0.0
                        (clang-700.0.59.5)]]
              platform: yes [darwin]

REQUIRED DEPENDENCIES AND EXTENSIONS
                 numpy: yes [version 1.10.4]
              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 [tornado was not found. It is required for the
                        WebAgg backend. pip/easy_install may attempt to
                        install it after matplotlib.]
             pyparsing: yes [pyparsing was not found. It is required for
                        mathtext support. pip/easy_install may attempt to
                        install it after matplotlib.]
                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.19]
                 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 [nose 0.11.1 or later is required to run the
                        matplotlib test suite. Please install it with pip or
                        your preferred tool to run the test suite / mock is
                        required to run the matplotlib test suite. Please
                        install it with pip or your preferred tool to run
                        the test suite]
        toolkits_tests: yes [nose 0.11.1 or later is required to run the
                        matplotlib test suite. Please install it with pip or
                        your preferred tool to run the test suite / mock is
                        required to run the matplotlib test suite. Please
                        install it with pip or your preferred tool to run
                        the test suite]

OPTIONAL BACKEND EXTENSIONS
                macosx: yes [installing, darwin]
                qt5agg: no  [PyQt5 not found]
                qt4agg: no  [PySide not found; 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: no
                 latex: no
               pdftops: no

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

============================================================================
                        * The following required packages can not be built:
                        * freetype
error: Setup script exited with 1

注意:我尝试安装此处列出的开发/源代码/标题,这似乎有效,但仍然无法解决我的问题:http://mac-dev-env.patrickbougie.com/freetype/

1 个答案:

答案 0 :(得分:0)

brew install pkg-config应该帮助matplotlib找到编译的依赖项。

或者,使用新版本的pip代替easy_install将在osx中​​下载二进制轮包,这更容易,不需要依赖。

即。 pip install matplotlib