When installing packages in Python using pip, I came across the following error:
unable to execute gcc-4.2: No such file or directory
Clearly, pip is trying to use gcc-4.2 which is not in any of the binary directories, namely /usr/bin. After looking around this site and others, I have found that many others are suffering from the same issue. However, gcc is updated to version 4.2 in OS X Lion and this is not a version problem, rather, gcc is just called gcc, not gcc-4.2, under /usr/bin, and is symlinked to llvm-gcc. After adding gcc-4.2 in /usr/bin as a symlink to gcc, pip was able to install everything successfully. Why is it then, that pip is looking for gcc-4.2 and not gcc? Is this the fault of pip, OS X Lion, or the packages within pip that are trying to install themselves with gcc-4.2?
Finally, is my symlink hack the right thing to do in this situation, or should I have fixed this some other way?
Your simlink hack is the right solution for now. Ultimately the people who support pip for the platform need to stop using explicit versions of the compiler that way. It was a bad idea to begin with and will only be worse as compilers on the platform change.
Contrary to Milad's answer there are other solutions to determining version in the host compiler and your solution will work until the people who support pip on the platform fix their code.