0
我無法在OS X(10.12.6)上的虛擬環境中使用pip
安裝matplotlib
。我正在使用內置的系統版本的Python(/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7
),它是Python 2的唯一已安裝版本。無法在OS X上的virtualenv中安裝matplotlib(10.12.6)
我使用virtualenv
(版本15.1.0)創建虛擬環境。 matplotlib
安裝控制檯輸出說它不能構建freetype
包,但我已經使用brew
(它安裝在/usr/local/Cellar/freetype
中)安裝了它。下面是安裝控制檯輸出:
(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
基本上,它看起來好像在虛擬環境中一樣,'pip'找不到'/ usr/local/Cellar/freetype'這個'brew'安裝的'freetype'包的路徑。所以我在'/ usr/local/lib/python/2.7/site-packages'中創建了這個包的符號鏈接,但是它仍然會失敗並顯示相同的消息。我也在虛擬環境中創建了相同的符號鏈接('./venv/usr/local/lib/ python2.7/site-packages/freetype'),但它仍然會失敗並出現相同的錯誤。 –