-1

I am a novice at these things. I have been all over the internet looking for a way to get around this error :

unable to execute gcc-4.2: No such file or directory
error: command 'gcc-4.2' failed with exit status 1

When trying to install the Python Image Library, I get this error each time I run :

python setup.py install

I have tried a number of solutions given on this site and others across the web and no luck.

I have tried installing PIL with Macports which seemed to work but when I ran syncdb on my Django models it told me to install PIL.

Kind of lost at the moment. Is there anyone who has a tested, fool-proof way to get around this problem?

cyberdelia
  • 5,343
  • 1
  • 19
  • 16
Carl W.
  • 573
  • 3
  • 8
  • 13
  • 1
    Try Pillow, which is install friendly work of PIL: http://pypi.python.org/pypi/Pillow - it might not solve your problem, but could give better error message – Mikko Ohtamaa May 27 '12 at 16:36
  • Thanks for the reply but no dice. I got the same error message when running sudo python setup.py build in the Pillow folder. unable to execute gcc-4.2: No such file or directory error: command 'gcc-4.2' failed with exit status 1 – Carl W. May 27 '12 at 16:44
  • Have you installed xcode and build toolkit? check http://stackoverflow.com/questions/6767481/where-can-i-find-make-program-for-mac-os-x-lion – okm May 27 '12 at 17:26
  • @okm Yes, I installed Xcode ver4.2. I am also on a Mac running Snow Leopard. I have searched and tried most if not all the solutions I have found here but to no avail. – Carl W. May 27 '12 at 18:09
  • 1
    Could you prive whole tracestack then? – okm May 28 '12 at 00:52

1 Answers1

2

In my experience PIL is a nightmare to build and install unless you are using pip. Try creating a virtualenv and then installing PIL inside it with:

pip install PIL

I have PIL running fine on Snow Leopard with Python 2.7 out of MacPorts with this technique.

If you have trouble getting virtualenv up and running, I suggest virtualenv-burrito, which will set everything up for you automatically.

glyphobet
  • 1,564
  • 11
  • 17
  • I am starting to think I am not meant to install PIL. I set up the virtualenv and used pip install to try and get the PIL in there and no luck. – Carl W. May 28 '12 at 01:22
  • Can you be more specific? Post every single step you have taken in full detail and the full results of any errors or tracebacks you have seen. Nobody can help you without that. – glyphobet May 28 '12 at 13:08