[Image-SIG] PIL help

Charlie Clark charlie.clark at clark-consulting.eu
Thu Dec 29 13:46:37 CET 2011

Hi Zachary,

Am 20.12.2011, 19:11 Uhr, schrieb Needell, Zachary <NeedellZ at si.edu>:

> Hi,
> I am a complete amateur at this.  I'm trying to install and run SciPy,  
> specifically ndimage, on my work computer (I'm doing image analysis--I'm  
> used to using IDL but don't want to pay for it).  It is a 64 bit macbook  
> pro running OS X Lion, I am using python 2.7.  Reading error messages  
> and looking around on the internet leads me to think that I need to  
> install PIL in order for everything to work.  I am trying to install it  
> going by the instructions, but I keep running into problems.

Unfortunately compiling posix binaries on Mac OS can be more complicated  
than it needs to be.

> Specifically it spits out:
> running install
> running build
> running build_py
> running build_ext
> --- using frameworks at /System/Library/Frameworks
> building '_imaging' extension
> gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -isysroot  
> /Developer/SDKs/MacOSX10.6.sdk -arch i386 -arch x86_64 -g -O2 -DNDEBUG  
> -g -O3 -DHAVE_LIBZ -I/System/Library/Frameworks/Tcl.framework/Headers  
> -I/System/Library/Frameworks/Tk.framework/Headers -IlibImaging  
> -I/Library/Frameworks/Python.framework/Versions/2.7/include  
> -I/usr/include  
> -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c  
> _imaging.c -o build/temp.macosx-10.6-intel-2.7/_imaging.o
> unable to execute gcc-4.2: No such file or directory
> error: command 'gcc-4.2' failed with exit status 1
> and then dies.  Am I making this more complicated than it needs to be?   
> I have installed xcode and that does not seem to fix it.
> Thanks for any help, keeping in mind that i'm a total newb.

The error you are getting is that the gcc compiler cannot be found which  
seems to suggest that you may not have installed XCode correctly. Python  
also seems to be set up to run on Mac OS Snow Leopard which is why it  
refers to -i386 and -x86_64 and macosx-10.6-intel. Lion is Mac OS 10.7  
uses just i686.

My suggestion to any Python on Mac OS is to use MacPorts for basic  
software components. One advantage this provides is version and security  
updates. You can download and install MacPorts from  
http://www.macports.org/install.php It requires X Code to work but comes  
with good instructions on how to do that. You can then install Python and  
related packages like this:

sudo port install python-27 py27-pip

sudo pip install scipy pillow ndimage

"Pillow" is a version of PIL that is very easy to install.

Charlie Clark
Managing Director
Clark Consulting & Research
German Office
Kronenstr. 27a
D- 40217
Tel: +49-211-600-3657
Mobile: +49-178-782-6226

More information about the Image-SIG mailing list