Python 在OS X 10.11上将matplotlib升级到1.5失败,原因是freetype
简单的Python 在OS X 10.11上将matplotlib升级到1.5失败,原因是freetype,python,matplotlib,freetype,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 matp
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包没有安装
任何帮助都将不胜感激 您可能需要安装
pkg config
。尝试:
brew install pkg-config
安装matplotlib
之前
有关此问题的更多讨论,请参阅。这听起来像是
matplotlib
对freetype
的路径感到困惑,但是pkg config
覆盖了这一点并设置了正确的路径。还有matplotlib
自述文件,它建议您需要pkg config
因为您使用的是Enthough,所以安装matplotlib之类的东西的推荐方法是安装,这是Enthough发行版的免费附加组件,您还可以访问约100个软件包,这些软件包可以轻松安装到Enthough中
您试图用
brew
执行的操作以及这些操作都不适用于开箱即用,需要您设置正确的环境变量和构建设置,因为整个系统不了解brew
的存在。我使用的是matplotlib、OSX 10.11、Python 3.6和matplotlib 1.5.1
生成virtualenv
(在没有空格的路径中)
我已经安装了python3,我发现提供符号链接并没有安装它,所以我按照symlink
到python3.6文件并使用了它。使用virtualenv-p
命令
我安装了xquartz
东西,默认情况下它不在osx
中,而且matplotlib
仍然不会安装。也就是说,直到我发现matplotlib
安装程序在/include/ft2buid.h
中查找,而不是在/include/freetype2/ft2build.h
中,所以我在库中设置了一个指向/freetype2/ft2build.h
文件的符号链接,然后运行了pip install matplotlib,它成功了
Python未作为框架安装
我试着制作一个名为frameworkpython的文件,它可以重新路由到python或其他什么东西,但没有成功
最后我发现了一张便条,上面写着“转到文件夹”:
~/.matplotlib
(逐字将其粘贴到“转到文件夹”对话框中)
然后创建一个名为matplotlibrc
(无文件扩展名)的纯文本文件,该文件仅包含以下文本:
后端:TkAgg
这就是我所说的巫毒,现在matplotlib的rain演示开始工作了
这个特定的问题可能只需要一个符号链接位,我给自己增加了virtualenv的复杂性,但我不记得为什么。我以前见过这个解决方案。但是brew返回
警告:pkg-config-0.29已安装
。另外,ls-l/usr/include/freetype2/ft2build.h
也找不到。它是否存在于其他地方?e、 g./usr/local/cillar/freetype/2.6.1/include/freetype2
?如果是这样的话,你可以ln-s/usr/local/cillar/freetype/2.6.1/include/freetype2/usr/include/freetype
谢谢,@birryrree已经回答了这个问题。更普遍的问题是,我使用的Python解释器不是由brew
管理的。另一方面,找不到ls-l/usr/include/freetype2/ft2build.h
。是否正在尝试将matplotlib安装到Python系统中?这看起来不像是要将其安装到brew
管理的Python中。我正在安装到EnThound(当前设置为默认的Python解释器)。由于您使用的是EnThound,建议您安装matplotlib
之类的东西。这是Enthough发行版的免费附加组件,您还可以访问约100个软件包,这些软件包可以轻松安装到Enthough中。您试图用brew
执行的操作和这些操作不适用于开箱即用,需要您设置正确的环境变量和生成设置,因为整个系统不了解brew
的存在。@birryrree有效。请随意将其作为答案发布,我会选择它!