2

I am trying to build some libraries (like fable, PIL..) on my Mac OS X Lion 10.7.3. When I enter the Python interpreter on the Terminal, I have the version 4.0.1 of gcc:

Python 2.7.2 (v2.7.2:8527427914a2, Jun 11 2011, 14:13:39) 
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin

But interestingly, if I enter python2.6, I have gcc 4.2.1:

[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.`

I want to use Python (version 2.7.2 because it's the latest I have), but compiling is impossible in this Python version. With the command python setup.py install, I have the error message:

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

Is it normal on a Mac? Can anybody help me to define gcc 4.2.1 for Python 2.7.2?

CoffeeRain
  • 4,460
  • 4
  • 31
  • 50
user1187727
  • 409
  • 2
  • 9
  • 19
  • It's not necessary to compile PIL with the same compiler version as Python. I don't know how to tell setuptools what compiler version to use. My first guess is `export CC=gcc`. – Sven Marnach Mar 12 '12 at 18:41
  • 1
    Your python 2.7.2 binary was compiled using GCC 4.0.1. Your python 2.6 was compiled using GCC 4.2.1. That does not mean that you actually have either of these GCC versions installed on your system. – sepp2k Mar 12 '12 at 18:41
  • 1
    [This](http://stackoverflow.com/questions/3500638/reinstalling-python-on-mac-os-10-6-with-a-different-gcc-version) might help a bit... – CoffeeRain Mar 12 '12 at 19:26
  • possible duplicate of [Edit C Compiler used in MySQLdb Python](http://stackoverflow.com/questions/9557516/edit-c-compiler-used-in-mysqldb-python) – Ignacio Vazquez-Abrams Mar 12 '12 at 19:34
  • I've tried to do `export CC=gcc`and I've gcc version 4.2.1 when I do `gcc -v`but when I launch sudo python setup.py install it's still asking about gcc-4.0 – user1187727 Mar 12 '12 at 22:40
  • When I edit /Library/Frameworks/Python.framework/Versions/Current/lib//python2.7/config/Makefile I can see here that CC=gcc-4.0 is still there. Maybe I can recompile my python with 4.2 version, but how to do this ? – user1187727 Mar 12 '12 at 22:41

1 Answers1

1

Entering this command export ARCHFLAGS="-arch i686" within sudo su mode solve the problem. Don't ask me why !

user1187727
  • 409
  • 2
  • 9
  • 19