1

downloaded tar file from here

http://sourceforge.net/projects/mysql-python/files/mysql-python/1.2.3/

and followed the guide at http://decoding.wordpress.com/2012/01/23/how-to-setup-django-and-mysql-python-on-mac-os-x-lion/.

Got Django installed successfully. Changed the site.cfg config in mysql_config = /usr/local/mysql-5.6.10-osx10.7-x86_64/mysql_config

Then ran sudo python setup.py build

Got this output

dyld: DYLD_ environment variables being ignored because main executable (/usr/bin/sudo)    is setuid or setgid
running build
running build_py
creating build
creating build/lib.macosx-10.6-intel-2.7
copying _mysql_exceptions.py -> build/lib.macosx-10.6-intel-2.7
creating build/lib.macosx-10.6-intel-2.7/MySQLdb
copying MySQLdb/__init__.py -> build/lib.macosx-10.6-intel-2.7/MySQLdb
copying MySQLdb/converters.py -> build/lib.macosx-10.6-intel-2.7/MySQLdb
copying MySQLdb/connections.py -> build/lib.macosx-10.6-intel-2.7/MySQLdb
copying MySQLdb/cursors.py -> build/lib.macosx-10.6-intel-2.7/MySQLdb
copying MySQLdb/release.py -> build/lib.macosx-10.6-intel-2.7/MySQLdb
copying MySQLdb/times.py -> build/lib.macosx-10.6-intel-2.7/MySQLdb
creating build/lib.macosx-10.6-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.macosx-10.6-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.macosx-10.6-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.6-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.macosx-10.6-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.6-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/REFRESH.py -> build/lib.macosx-10.6-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.6-intel-2.7/MySQLdb/constants
running build_ext
building '_mysql' extension
creating build/temp.macosx-10.6-intel-2.7
gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -g -O2 -DNDEBUG -g -O3 -Dversion_info=    (1,2,3,'final',0) -D__version__=1.2.3 -I/usr/local/mysql-5.6.10-osx10.7-x86_64/include -    I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _mysql.c -o     build/temp.macosx-10.6-intel-2.7/_mysql.o -Os -g -fno-strict-aliasing -arch x86_64
unable to execute gcc-4.2: No such file or directory
error: command 'gcc-4.2' failed with exit status 1

Where are these errors coming from? Found solutions for Snow Leopard but not Mountain Lion. Thanks.

Badmiral
  • 1,549
  • 3
  • 35
  • 74
  • Have you tried using ``brew`` and ``pip`` to install these ? As it would negate the need to download tars etc. Apologies if you've tried and it doesn't cover it. – sotapme Feb 22 '13 at 13:50
  • haven't tried it yet, still new to terminal – Badmiral Feb 22 '13 at 13:51
  • Have you tried installing gcc-4.2? – LtWorf Feb 22 '13 at 13:54
  • You either did not install the `command-line-tools` from Xcode or you no longer have `gcc-4.2`. `distutils` determines that you need `gcc-4.2` because that was the compiler used to compile this python you are using to compile this extension. To check that, try `from distutils import sysconfig; sysconfig.get_config_var('LDSHARED')`. You can try modifying this configuration, as well the `CC` one, but it is not entirely recommended. – mmgp Feb 22 '13 at 13:54
  • Solved it by using this answer http://stackoverflow.com/questions/7949024/gcc-4-2-error-when-using-pip-in-virtualenv-on-osx-10-7 – Badmiral Feb 22 '13 at 14:09

1 Answers1

2

Looks like you don't have gcc-4.2 installed. Keep in mind it might be called something different. On my machine, the gcc executable is called gcc-apple-4.2

mbatchkarov
  • 15,487
  • 9
  • 60
  • 79