2012-01-29 46 views
0

當試圖在mac osx上安裝PIL時,我做了sudo python setup.py install並獲得了一切正常,但輸出如下。這之前是否發生過這種情況?PIL中的框架有問題

running build_ext 
--- using frameworks at /System/Library/Frameworks 
building '_imaging' extension 
creating build/temp.macosx-10.6-universal-2.6 
creating build/temp.macosx-10.6-universal-2.6/libImaging 
gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch ppc -arch x86_64 -pipe -DHAVE_LIBJPEG -DHAVE_LIBZ -I/System/Library/Frameworks/Tcl.framework/Headers -I/System/Library/Frameworks/Tk.framework/Headers -IlibImaging -I/opt/local/include -I/System/Library/Frameworks/Python.framework/Versions/2.6/include -I/usr/local/include -I/usr/include -I/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c _imaging.c -o build/temp.macosx-10.6-universal-2.6/_imaging.o 
_imaging.c:3017: warning: initialization from incompatible pointer type 
_imaging.c:3077: warning: initialization from incompatible pointer type 
/usr/libexec/gcc/powerpc-apple-darwin10/4.2.1/as: assembler (/usr/bin/../libexec/gcc/darwin/ppc/as or /usr/bin/../local/libexec/gcc/darwin/ppc/as) for architecture ppc not installed 
Installed assemblers are: 
/usr/bin/../libexec/gcc/darwin/x86_64/as for architecture x86_64 
/usr/bin/../libexec/gcc/darwin/i386/as for architecture i386 
_imaging.c:3017: warning: initialization from incompatible pointer type 
_imaging.c:3077: warning: initialization from incompatible pointer type 
_imaging.c:3281: fatal error: error writing to -: Broken pipe 
compilation terminated. 
_imaging.c:3017: warning: initialization from incompatible pointer type 
_imaging.c:3077: warning: initialization from incompatible pointer type 
lipo: can't open input file: /var/tmp//ccltKqHA.out (No such file or directory) 
error: command 'gcc-4.2' failed with exit status 1 
+1

這是一個重複的http://stackoverflow.com/questions/7473896/failed-to-build-pil-on-mac-os-x-10-7-lion? 我也建議你使用macports或brew來安裝PIL,而不是「sudo python setup.py install」。 – 2012-01-29 03:15:28

+0

必須有辦法使用PIL否? – locoboy 2012-01-29 05:09:03

+1

嘗試'PIP安裝枕頭' - 我是一個轉換! – 2012-01-29 08:02:56

回答

0
  1. 安裝Homebrew
  2. brew install python mysql
  3. easy_install pip
  4. pip install virtualenv virtualenvwrapper
  5. echo "source /usr/local/bin/virtualenvwrapper.sh > /dev/null" >> ~/.bash_profile
  6. source ~/.bash_profile
  7. mkvirtualenv --no-site-packages <your env name>
  8. pip install django pillow
+1

爲什麼不只是''brew安裝pil''? – jterrace 2012-01-29 19:39:31

+0

我做過了,但我還需要'ls -s'安裝到網站包dir – locoboy 2012-01-29 21:34:48

+0

jterrace,有virtualenv讓你的python東西保持形狀 – 2012-01-30 08:58:02

0

兩件事。首先,請確保set your architecture,第二,使用pillow而不是PIL,因爲它是一個積極維護的PIL分支。即

ARCHFLAGS="-arch i386 -arch x86_64" sudo pip install pillow 

如果你的環境是所有從你第一次嘗試打亂了,這裏是在哪裏find and remove old PIL files一些建議。