When I install PIL (or pad), the _imaging C module is not installed.
This is a common mistake, and we saw the AppeL play-by-play solution , which most of them found useful. Unfortunately, when I run sudo python setup.py install , I get the following error:
running install running build running build_py running build_ext --- using frameworks at /System/Library/Frameworks building '_imaging' extension gcc-4.0 -fno-strict-aliasing -fno-common -dynamic -arch ppc -arch i386 -g -O2 -DNDEBUG -g -O3 -DHAVE_LIBJPEG -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/local/include -I/usr/include -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _imaging.c -o build/temp.macosx-10.3-fat-2.7/_imaging.o unable to execute gcc-4.0: No such file or directory error: command 'gcc-4.0' failed with exit status 1
When I run python in a shell and try to import modules, I get the following import errors:
Santiagos-MacBook-Air:Imaging-1.1.7 sgarza621$ python Python 2.7.3 (v2.7.3:70274d53c1dd, Apr 9 2012, 20:32:06) [GCC 4.0.1 (Apple Inc. build 5493)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import PIL >>> import Image Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: No module named Image >>> import _imaging Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: No module named _imaging
I had similar errors earlier , and Ned Deily was kind enough to provide solutions . I believe that my current problem may be related to this previous question:
OSX: error installing Python packages (including this link)
Here is another potentially useful information:
Santiagos-MacBook-Air:Imaging-1.1.7 sgarza621$ python Python 2.7.3 (v2.7.3:70274d53c1dd, Apr 9 2012, 20:32:06) [GCC 4.0.1 (Apple Inc. build 5493)] on darwin Type "help", "copyright", "credits" or "license" for more information.
Santiagos-MacBook-Air:Imaging-1.1.7 sgarza621$ gcc i686-apple-darwin11-llvm-gcc-4.2: no input files
Santiagos-MacBook-Air:Imaging-1.1.7 sgarza621$ which python /Library/Frameworks/Python.framework/Versions/2.7/bin/python
Santiagos-MacBook-Air:Imaging-1.1.7 sgarza621$ echo $PATH /Library/Frameworks/Python.framework/Versions/2.7/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
I am not very familiar with inserts if gcc, Xcode or PIL. So, if you do not mind, provide detailed answers so that I understand how to act on your decision. Also, let me know if I can provide more details, and I will edit them in the question.
EDIT:
I installed a pillow with pip, as suggested by MattDMo , Image now successfully imported, but _imaging not (I believe c extensions will not compile gcc properly on my machine, see above):
Santiagos-MacBook-Air:riotry_mobile sgarza621$ python Python 2.7.3 (v2.7.3:70274d53c1dd, Apr 9 2012, 20:32:06) [GCC 4.0.1 (Apple Inc. build 5493)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import Image >>> import _imaging Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/_imaging.so, 2): Symbol not found: _jpeg_resync_to_restart Referenced from: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/_imaging.so Expected in: dynamic lookup
I use PIL for image processing in a Django web application, and I get the following error when trying to upload an image through a processing form using PIL:
The _imaging C module is not installed
SECOND EDIT:
Here's more info related to python and gcc, which I hope will shed light on the problem:
$ which python /Library/Frameworks/Python.framework/Versions/2.7/bin/python $ /usr/bin/python -c 'import sys;print(sys.version)' 2.7.2 (default, Jun 16 2012, 12:38:40) [GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] $ /usr/bin/python2.7 -c 'import sys;print(sys.version)' 2.7.2 (default, Jun 16 2012, 12:38:40) [GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)]