[英]Unable to install matplotlib in virtualenv on OS X (10.12.6)
I'm unable to install matplotlib
using pip
in a virtual environment on OS X (10.12.6). 我无法在OS X(10.12.6)的虚拟环境中使用
pip
安装matplotlib
。 I am using the built-in system version of Python ( /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7
) which is the only installed version of Python 2. 我正在使用Python的内置系统版本(
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7
),这是Python 2的唯一已安装版本。
I used virtualenv
(version 15.1.0) to create the virtual environment. 我使用
virtualenv
(15.1.0版)创建了虚拟环境。 The matplotlib
installation console output says that it could not build the freetype
package, but I've installed this already using brew
(it installed it in /usr/local/Cellar/freetype
). matplotlib
安装控制台输出显示无法构建freetype
软件包,但我已经使用brew
安装了它(它已安装在/usr/local/Cellar/freetype
)。 Here's the installation console output: 这是安装控制台的输出:
(venv) $ pip install matplotlib
You are using pip version 7.0.3, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting matplotlib
Using cached matplotlib-2.0.2.tar.gz
Complete output from command python setup.py egg_info:
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 [2.0.2]
python: yes [2.7.10 (default, Feb 7 2017, 00:08:15) [GCC
4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.34)]]
platform: yes [darwin]
REQUIRED DEPENDENCIES AND EXTENSIONS
numpy: yes [not found. pip may install it below.]
six: yes [using six version 1.10.0]
dateutil: yes [using dateutil version 2.6.1]
functools32: yes [functools32 was not found. It is required
forPython versions prior to 3.2]
subprocess32: yes [subprocess32 was not found. It used for Python
versions prior to 3.2 to improves functionality on
Linux and OSX]
pytz: yes [using pytz version 2017.2]
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.31]
qhull: yes [pkg-config information for 'qhull' could not be
found. Using local copy.]
OPTIONAL SUBPACKAGES
sample_data: yes [installing]
toolkits: yes [installing]
tests: no [skipping due to configuration]
toolkits_tests: no [skipping due to configuration]
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; run-time loading from Python Tcl /
Tk]
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
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/vx/3ts13s190k50b2gzt_6zyp0m0000gn/T/pip-build-HCJwzO/matplotlib
好的,因此我设法自己解决了此问题,方法是使用brew
安装并链接pkg-config
软件包,然后在虚拟环境中运行pip install matplotlib
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.