问题描述
在安装matplotlib
时遇到问题.我正在使用Mavericks,它抱怨既不推荐通过NumPy API进行安装,也可以通过pip
进行安装,也可以通过源代码进行安装(遵循此处的说明 https://github.com/matplotlib/matplotlib/blob/master/README.osx ):
I'm having problem while installing matplotlib
. I'm using Mavericks and it complains about a deprecated NumPy API both installing via pip
and installing from source (following the instructions here https://github.com/matplotlib/matplotlib/blob/master/README.osx):
In file included from src/_macosx.m:1:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:12:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:10:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSArray.h:5:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObject.h:76:1: error:
duplicate interface definition for class 'NSObject'
@interface NSObject <NSObject> {
^
/usr/include/objc/NSObject.h:50:12: note: previous definition is here
@interface NSObject <NSObject> {
^
In file included from src/_macosx.m:5:
In file included from /Users/se7entyse7en/Envs/datascience/lib/python2.7/site-packages/numpy/core/include/numpy/arrayobject.h:4:
In file included from /Users/se7entyse7en/Envs/datascience/lib/python2.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:17:
In file included from /Users/se7entyse7en/Envs/datascience/lib/python2.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1761:
/Users/se7entyse7en/Envs/datascience/lib/python2.7/site-packages/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 " \
^
1 warning and 1 error generated.
error: command 'clang' failed with exit status 1
之后,它存在而未完成安装.我已经使用brew
安装了libpng
和freetype
,并且还已经通过pip
安装了NumPy
和SciPy
:
After that it exists without having completed the installation. I have already installed both libpng
and freetype
using brew
, and I also already have installed both NumPy
and SciPy
via pip
:
numpy==1.8.2
scipy==0.14.0
推荐答案
好,我也通过flebool解决了这个问题.在文件夹中
Ok, I solved the issue also thanks to flebool. In the folder
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs
我同时拥有MacOSX10.9.sdk
和MacOSX10.8.sdk
,但我不知道它们是否应该同时存在.我有小牛队,所以我认为也许MacOSX10.8.sdk
可能是问题所在.我删除了它,并成功从源代码成功安装了matplotlib
.
I had both MacOSX10.9.sdk
and MacOSX10.8.sdk
and I didn't know if they should exists both. I had Mavericks so I thought that maybe MacOSX10.8.sdk
could be the problem. I deleted it and I managed to install matplotlib
from source succesfully.
这篇关于在Mavericks上安装Matplotlib的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!