我正在尝试使用OS X 10.8和XCode 5.0.2在我的机器上安装matplotlib。我得到了这些奇怪的错误,我无法理解。我使用pip install matplotlib
来安装软件包,但最后它会返回以下错误。我不知道该怎么做。请帮我继续我试图通过相同的进程安装scipy,并且相同的错误流占优势。
building 'rootfind' library
compiling C sources
C compiler: clang -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe
creating build/temp.macosx-10.8-intel-2.7/scipy/optimize/Zeros
compile options: '-I/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy/core/include -c'
clang: scipy/optimize/Zeros/bisect.c
clang: error: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
clang: error: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
error: Command "clang -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -I/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy/core/include -c scipy/optimize/Zeros/bisect.c -o build/temp.macosx-10.8-intel-2.7/scipy/optimize/Zeros/bisect.o" failed with exit status 1
----------------------------------------
Cleaning up...
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/private/var/folders/v3/xf03tznj5hn9mj7j_4jbkvw40000gn/T/pip_build_Siva/scipy/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/v3/xf03tznj5hn9mj7j_4jbkvw40000gn/T/pip-u0HK_Y-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /private/var/folders/v3/xf03tznj5hn9mj7j_4jbkvw40000gn/T/pip_build_Siva/scipy
在此之后,我将ARCHFLAGS
变量设置为以下
export ARCHFLAGS='-Wno-error=unused-command-line-argument-hard-error-in-future'
虽然安装进一步进行,但我现在在不同的点获得错误流。
running build_ext
building 'matplotlib.ft2font' extension
creating build/temp.macosx-10.8-intel-2.7
creating build/temp.macosx-10.8-intel-2.7/src
creating build/temp.macosx-10.8-intel-2.7/CXX
clang -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wshorten-64-to-32 -DNDEBUG -g -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -DPY_ARRAY_UNIQUE_SYMBOL=MPL_matplotlib_ft2font_ARRAY_API -DPYCXX_ISO_CPP_LIB=1 -I/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy/core/include -I/usr/local/include -I/usr/include -I. -I/usr/local/Cellar/freetype/2.5.3_1/include/freetype2 -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/ft2font.cpp -o build/temp.macosx-10.8-intel-2.7/src/ft2font.o
clang: error: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
error: command 'clang' failed with exit status 1
----------------------------------------
Cleaning up...
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/private/tmp/pip_build_root/matplotlib/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-ZU81yE-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /private/tmp/pip_build_root/matplotlib
答案 0 :(得分:1)
这是一个常见问题,最后的macos更新使clang生成错误而不是未知编译器选项的警告。作为临时解决方法,您可以在运行pip:
之前设置ARCHFLAGS环境变量export ARCHFLAGS='-Wno-error=unused-command-line-argument-hard-error-in-future'
答案 1 :(得分:0)
我更喜欢在OS X上使用Canopy作为python环境,因为在Mac上安装python包通常比较困难。
您可以在此处获取:https://www.enthought.com/downloads/。
默认安装MatPlotLib,安装Canopy后更容易安装更多软件包。