简体   繁体   English

在OS X 10.8上安装matplotlib时出错

[英]Errors while installing matplotlib on OS X 10.8

I am trying to install matplotlib on my machine with OS X 10.8 and XCode 5.0.2. 我正在尝试在装有OS X 10.8和XCode 5.0.2的计算机上安装matplotlib。 I get these weird errors of which I am not able to make sense. 我遇到了这些我无法理解的怪异错误。 I used pip install matplotlib to install the package, but then it returns the following errors at the end. 我使用pip install matplotlib安装软件包,但是最后它返回以下错误。 I am clueless on what to do. 我对如何做一无所知。 Please help me proceed. 请帮助我继续。 I tried to install scipy through the same process and the same error stream prevails. 我尝试通过相同的过程安装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

After this I set the ARCHFLAGS variable to the following 之后,我将ARCHFLAGS变量设置为以下内容

export ARCHFLAGS='-Wno-error=unused-command-line-argument-hard-error-in-future'

Although the installatoion proceeds a bit further, I get an error stream at a different point now. 尽管安装过程进行得更远,但现在我在另一个地方遇到了错误流。

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

That's a common problem, the last macos updates make clang generate errors instead of warnings for unknown compiler options. 这是一个常见问题,最近的macOS更新使clang生成错误,而不是针对未知编译器选项的警告。 As a temporary workaround you could set ARCHFLAGS environment variable, before running pip: 作为临时的解决方法,您可以在运行pip之前设置ARCHFLAGS环境变量:

export ARCHFLAGS='-Wno-error=unused-command-line-argument-hard-error-in-future'

I prefer to use Canopy as a python environment on OS X since it is usually harder to install python packages on a Mac. 我更喜欢将Canopy用作OS X上的python环境,因为通常很难在Mac上安装python软件包。

You can get it here : https://www.enthought.com/downloads/ . 您可以在这里获取它: https : //www.enthought.com/downloads/

MatPlotLib is installed by default, and many more packages are easier to install after installing Canopy. MatPlotLib默认情况下已安装,并且在安装Canopy之后,更容易安装更多软件包。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM