简体   繁体   中英

Error installing matplotlib on OSX

I'm trying to get plotting abilities setup for pandas and I'm following this:

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

When I attempt to install I get an error regarding freetype not being installed. However, it's already installed:

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

Full install log

$ 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

NOTE: I tried installing the development/from-source/headers as listed here, which appeared to work but still didn't solve my issue: http://mac-dev-env.patrickbougie.com/freetype/

brew install pkg-config should help matplotlib find dependencies for compilation.

Alternatively, using a new version of pip instead of easy_install will download binary wheel packages in osx which is easier and doesn't require dependencies.

ie pip install matplotlib

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM