简体   繁体   English

在OSX上安装Matplotlib时出错

[英]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. 尝试安装时,出现关于未安装freetype的错误。 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/ 注意:我尝试安装此处列出的development / from-source / header,虽然看起来可以正常工作,但仍不能解决我的问题: http : //mac-dev-env.patrickbougie.com/freetype/

brew install pkg-config should help matplotlib find dependencies for compilation. brew install pkg-config应该可以帮助matplotlib找到要编译的依赖项。

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. 或者,使用新版本的pip而不是easy_install将在osx中​​下载二进制车轮软件包,这更容易并且不需要依赖项。

ie pip install matplotlib pip install matplotlib

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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