Friday, August 24, 2012

No GCC in Mac OS X Python

GCC - No such file or directory on Mac OS X in Python 2.7

Python 2.7 default requires a GCC 4.2 compiler. However the Mac OS X does not have a built-in GCC. To install GCC, we can download XCode (if you do not want such a huge thing to be installed, choose to install only the command line tool from Apple. Refer to this link.)

After that, you can go to terminal and type:

gcc -v

You should be able to see the info of GCC.
However, Python specifies GCC-4.2 to be called in the interpreter. This can be solved by changing the name of "gcc" alias in /usr/bin/ to "gcc-4.2". This allows gcc-4.2 to be called in Python. But in the terminal you should now type:

gcc-4.2 -v

to get the gcc version info.

No comments:

Post a Comment