[英]Cannot install Matplotlib on Mac
I cannot install Matplotlib on Mavericks 10.9. 我不能在Mavericks 10.9上安装Matplotlib。 I have the following error message telling me freetype cannot be built: 我有以下错误消息告诉我无法构建freetype:
============================================================================
Edit setup.cfg to change the build options
BUILDING MATPLOTLIB
matplotlib: yes [1.3.1]
python: yes [2.7.6 (default, Apr 9 2014, 11:48:52) [GCC
4.2.1 Compatible Apple LLVM 5.1 (clang-503.0.38)]]
platform: yes [darwin]
REQUIRED DEPENDENCIES AND EXTENSIONS
numpy: yes [version 1.8.1]
dateutil: yes [dateutil was not found. It is required for date
axis support. pip/easy_install may 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.]
pycxx: yes [Couldn't import. Using local copy.]
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 [pkg-config information for 'libpng' could not
be found. Using unknown version.]
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]
OPTIONAL BACKEND EXTENSIONS
macosx: yes [installing, darwin]
qt4agg: no [PyQt4 not found]
gtk3agg: no [Requires pygobject to be installed.]
gtk3cairo: no [Requires cairo 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 [cairo not found]
windowing: no [Microsoft Windows only]
OPTIONAL LATEX DEPENDENCIES
dvipng: no
ghostscript: no
latex: no
pdftops: no
============================================================================
* 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.3.1]
python: yes [2.7.6 (default, Apr 9 2014, 11:48:52) [GCC
4.2.1 Compatible Apple LLVM 5.1 (clang-503.0.38)]]
platform: yes [darwin]
REQUIRED DEPENDENCIES AND EXTENSIONS
numpy: yes [version 1.8.1]
dateutil: yes [dateutil was not found. It is required for date
axis support. pip/easy_install may 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.]
pycxx: yes [Couldn't import. Using local copy.]
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 [pkg-config information for 'libpng' could not
be found. Using unknown version.]
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]
OPTIONAL BACKEND EXTENSIONS
macosx: yes [installing, darwin]
qt4agg: no [PyQt4 not found]
gtk3agg: no [Requires pygobject to be installed.]
gtk3cairo: no [Requires cairo 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 [cairo not found]
windowing: no [Microsoft Windows only]
OPTIONAL LATEX DEPENDENCIES
dvipng: no
ghostscript: no
latex: no
pdftops: no
============================================================================
* The following required packages can not be built:
* freetype
----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /private/var/folders/jj/0w0dd3n16jq4g5579g6c7h040000gn/T/pip_build_mc/matplotlib
Storing debug log for failure in /Users/mc/.pip/pip.log
I have followed the instructions here and here but it still doesn't work. 我已按照此处和此处的说明进行操作,但仍然无效。 This is a clean system install and I just installed Python with brew as well. 这是一个干净的系统安装,我也用brew安装了Python。
I had to install pkg-config with brew to fix it 我不得不用brew安装pkg-config来修复它
brew install freetype
brew install pkg-config
'brew list' now reports: 'brew list'现在报道:
freetype libpng pkg-config
Use home-brew python to install Matplotlib. 使用home-brew python安装Matplotlib。 That finally fixed it for me: 这终于为我修好了:
brew tap Homebrew/python # installs the Homebrew/python "tap"
brew install matplotlib # install matplotlib with homebrew
More info here: https://github.com/Homebrew/homebrew-python 更多信息: https : //github.com/Homebrew/homebrew-python
I think the issue is that freetype's headers installed by brew are not in the path searched by the matplotlib build. 我认为问题是brew安装的freetype的头文件不在matplotlib构建的搜索路径中。 I had the same issue. 我遇到过同样的问题。 Try 尝试
ln -s /usr/local/opt/freetype/include/freetype2 /usr/local/include/freetype
I had also to install pkg-config 我还要安装pkg-config
brew install freetype
brew install pkg-config
Besides that I got the same error. 除此之外,我得到了同样的错误。 When I ran brew install freetype again it said "Warning: freetype-2.7.1 already installed, it's just not linked." 当我再次运行brew install freetype时,它说“警告:已经安装了freetype-2.7.1,它只是没有链接。”
I fixed that by running following line: 我通过运行以下行来修复它:
brew link libpng freetype
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.