2013-03-26 60 views
3

我安裝了numpy,當我去安裝Matplotlib時,它失敗了。不管我用來安裝它的方法如何。以下是我收到的錯誤。Matplotlib無法在Mac OS 10.8.2上使用Python 2.7.3安裝

gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -arch i386 -arch x86_64 -g -O2 -  
DNDEBUG -g -O3 -DPY_ARRAY_UNIQUE_SYMBOL=MPL_ARRAY_API -DPYCXX_ISO_CPP_LIB=1 - 
I/usr/local/include -I/usr/include -I/usr/X11/include -I/opt/local/include - 
I/usr/local/include -I/usr/include -I. - 
I/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy/core/include -I. -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/_png.cpp -o build/temp.macosx-10.6-intel-2.7/src/_png.o 

src/_png.cpp:23:20: error: png.h: No such file or directory 

src/_png.cpp:66: error: variable or field ‘write_png_data’ declared void 

src/_png.cpp:66: error: ‘png_structp’ was not declared in this scope 

src/_png.cpp:66: error: ‘png_bytep’ was not declared in this scope 

src/_png.cpp:66: error: ‘png_size_t’ was not declared in this scope 

src/_png.cpp:23:20: error: png.h: No such file or directory 

src/_png.cpp:66: error: variable or field ‘write_png_data’ declared void 

src/_png.cpp:66: error: ‘png_structp’ was not declared in this scope 

src/_png.cpp:66: error: ‘png_bytep’ was not declared in this scope 

src/_png.cpp:66: error: ‘png_size_t’ was not declared in this scope 

lipo: can't figure out the architecture type of: 
/var/folders/c9/xzv35t2n3ld9lgjrtl0vd0xr0000gn/T//ccwRj4ny.out 

error: command 'gcc-4.2' failed with exit status 1 

---------------------------------------- 

Command /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python - 
c "import setuptools;__file__='/var/folders/c9/xzv35t2n3ld9lgjrtl0vd0xr0000gn/T/pip- 
build/matplotlib/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), 
__file__, 'exec'))" install --record /var/folders/c9/xzv35t2n3ld9lgjrtl0vd0xr0000gn/T/pip- 
udXluz-record/install-record.txt --single-version-externally-managed failed with error 
code 1 in /var/folders/c9/xzv35t2n3ld9lgjrtl0vd0xr0000gn/T/pip-build/matplotlib 
Storing complete log 
+3

看起來你沒有做的libpng。根據您選擇的背景,您也可能會發現其他編譯問題。如果你想從源代碼編譯,你應該明白什麼是需求並安裝它們。我通常會避免從源代碼編譯,尤其是對於OSX,如果有很多其他選項可用的話。 – tiago 2013-03-26 16:49:33

+1

我建議安裝matplotlib自帶的[anaconda](https://store.continuum.io/cshop/anaconda)。 – 2013-03-26 18:10:29

回答

0

文件png.h安裝有libpng,這是構建matplotlib的要求。

請注意,更高版本的libpng(1.5和1.6有很大的不同,並且爲1.2或更高的要求規範可能不會因爲不兼容的對你的工作,我已經成功地被使用的libpng 1.2 matplotlib,但有未嘗試過最新的1.6系列