我尝试从源代码安装matplotlib,然后遇到一些非常奇怪的错误。
运行后的日志" python setup.py build":
BUILDING MATPLOTLIB
matplotlib: yes [1.4.x]
python: yes [2.7.6 (default, Jan 15 2014, 13:39:04) [GCC
4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.28)]]
platform: yes [darwin]
REQUIRED DEPENDENCIES AND EXTENSIONS
numpy: yes [version 1.9.0.dev-7f46687]
six: yes [six was not found.]
dateutil: yes [using dateutil version 1.5]
tornado: yes [using tornado version 3.1.1]
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: yes [version 17.1.1]
png: yes [version 1.5.17]
OPTIONAL SUBPACKAGES
sample_data: yes [installing]
toolkits: yes [installing]
tests: yes [using nose version 1.3.0]
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: yes [version 1.14]
ghostscript: yes [version 9.02]
latex: yes [version 3.1415926]
pdftops: no
running build
running build_py
copying lib/matplotlib/mpl-data/matplotlibrc -> build/lib.macosx-10.7-x86_64-2.7/matplotlib/mpl-data
running build_ext
building 'matplotlib.ft2font' extension
clang -fno-strict-aliasing -fno-common -dynamic -I/usr/local/include -I/usr/local/opt/sqlite/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -DNDEBUG -g -fwrapv -O3 -Wall -DPY_ARRAY_UNIQUE_SYMBOL=MPL_matplotlib_ft2font_ARRAY_API -DPYCXX_ISO_CPP_LIB=1 -I/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy-1.9.0.dev_7f46687-py2.7-macosx-10.7-x86_64.egg/numpy/core/include -I/usr/local/Cellar/freetype/2.5.2/include/freetype2 -I/usr/include -I/usr/local/include -I. -Iextern -I/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/ft2font.cpp -o build/temp.macosx-10.7-x86_64-2.7/src/ft2font.o
In file included from src/ft2font.cpp:7:
In file included from src/file_compat.h:4:
In file included from /usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy-1.9.0.dev_7f46687-py2.7-macosx-10.7-x86_64.egg/numpy/core/include/numpy/npy_3kcompat.h:23:
In file included from /usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy-1.9.0.dev_7f46687-py2.7-macosx-10.7-x86_64.egg/numpy/core/include/numpy/ndarrayobject.h:17:
In file included from /usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy-1.9.0.dev_7f46687-py2.7-macosx-10.7-x86_64.egg/numpy/core/include/numpy/ndarraytypes.h:1760:
/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy-1.9.0.dev_7f46687-py2.7-macosx-10.7-x86_64.egg/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning:
"Using deprecated NumPy API, disable it by " "#defining
NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-W#warnings]
#warning "Using deprecated NumPy API, disable it by " \
^
In file included from src/ft2font.cpp:7:
In file included from src/file_compat.h:4:
/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy-1.9.0.dev_7f46687-py2.7-macosx-10.7-x86_64.egg/numpy/core/include/numpy/npy_3kcompat.h:288:40: warning:
conversion from string literal to 'char *' is deprecated
[-Wdeprecated-writable-strings]
return PyObject_CallFunction(open, "Os", filename, mode);
^
/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy-1.9.0.dev_7f46687-py2.7-macosx-10.7-x86_64.egg/numpy/core/include/numpy/npy_3kcompat.h:296:37: warning:
conversion from string literal to 'char *' is deprecated
[-Wdeprecated-writable-strings]
ret = PyObject_CallMethod(file, "close", NULL);
^
src/ft2font.cpp:191:46: error: too few arguments provided to function-like macro
invocation
fh = npy_PyFile_Dup(py_file, (char *)"wb");
^
src/ft2font.cpp:191:10: error: use of undeclared identifier 'npy_PyFile_Dup'
fh = npy_PyFile_Dup(py_file, (char *)"wb");
^
src/ft2font.cpp:195:36: error: too few arguments provided to function-like macro
invocation
npy_PyFile_DupClose(py_file, fh);
^
src/ft2font.cpp:195:5: error: use of undeclared identifier 'npy_PyFile_DupClose'
npy_PyFile_DupClose(py_file, fh);
^
src/ft2font.cpp:2144:46: error: too few arguments provided to function-like
macro invocation
npy_PyFile_DupClose(def->py_file, def->fp);
^
src/ft2font.cpp:2144:5: error: use of undeclared identifier
'npy_PyFile_DupClose'
npy_PyFile_DupClose(def->py_file, def->fp);
^
src/ft2font.cpp:2181:51: error: too few arguments provided to function-like
macro invocation
if ((fp = npy_PyFile_Dup(py_file, (char *)"rb"))) {
^
src/ft2font.cpp:2181:15: error: use of undeclared identifier 'npy_PyFile_Dup'
if ((fp = npy_PyFile_Dup(py_file, (char *)"rb"))) {
^
src/ft2font.cpp:2207:54: warning: conversion from string literal to 'char *' is
deprecated [-Wdeprecated-writable-strings]
(data = PyObject_CallMethod(py_file_arg, "read", ""))) {
^
src/ft2font.cpp:2207:62: warning: conversion from string literal to 'char *' is
deprecated [-Wdeprecated-writable-strings]
(data = PyObject_CallMethod(py_file_arg, "read", ""))) {
^
5 warnings and 8 errors generated.
error: command 'clang' failed with exit status 1
这似乎是个尴尬的问题。我试图使用旧版本1.5.1,它也遇到了类似的问题。无论如何要修复它而不重新安装一切?谢谢!
答案 0 :(得分:0)
对于它的价值,我经常发现编译Numpy,Scipy和Matplotlib对Mac来说是一种痛苦。我已经有了它的工作,但你可以通过安装免费的Canopy Express来节省你自己的时间,并为你提供一个完整的Python环境,包括Scipy,Numpy,iPython,pandas和其他一些有用的软件包。< / p>
请注意 - 我不为Enthought工作,我也不想让你和他们一起花钱!但是他们的免费产品为我节省了大量时间在Mac上调试这些软件包的安装问题。您可能会发现值得研究。