By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
439,986 Members | 1,551 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 439,986 IT Pros & Developers. It's quick & easy.

Error Connection in MySQLdb and Python in MAC OS X.

P: 8
I'm doing a small project on Python using MySQL as Database in MAC OS X.
I was unable to connect the database. I was downloaded MySQLdb from and I also modified After modified and restart the I'm getting an error "gcc" cannot find the file.
This is the error it was getting when I was reinstalling the
"Administrator:MySQL-python-1.2.2 administrator$ sudo python install
running install
running bdist_egg
running egg_info
writing MySQL_python.egg-info/PKG-INFO
writing top-level names to MySQL_python.egg-info/top_level.txt
writing dependency_links to MySQL_python.egg-info/dependency_links.txt
reading manifest file 'MySQL_python.egg-info/SOURCES.txt'
reading manifest template ''
writing manifest file 'MySQL_python.egg-info/SOURCES.txt'
installing library code to build/bdist.macosx-10.3-fat/egg
running install_lib
running build_py
copying MySQLdb/ -> build/lib.macosx-10.3-fat-2.5/MySQLdb
running build_ext
building '_mysql' extension
gcc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -fno-strict-aliasing -Wno-long-double -no-cpp-precomp -mno-fused-madd -fno-common -dynamic -DNDEBUG -g -O3 -Dversion_info=(1,2,2,'final',0) -D__version__=1.2.2 -I/usr/local/mysql/include -I/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5 -c _mysql.c -o build/temp.macosx-10.3-fat-2.5/_mysql.o -g -Os -arch i386 -fno-common -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT -DDONT_DECLARE_CXA_PURE_VIRTUAL
unable to execute gcc: No such file or directory
error: command 'gcc' failed with exit status 1"
Please suggest me what to do and how to go further....
Thank You in advance for Your suggestion and help me.
Warm Regards,
Feb 6 '09 #1
Share this Question
Share on Google+
1 Reply

P: 8

Follow the steps to connect the MySQL database using Python:

1) first download the mysql-python 1.2.2 from

2)modify the line numbers:29,35

from mysql_config.path="mysql_config"


mysql_config.path = "/usr/local/mysql/bin/mysql_config"

3) save the file and now go to terminal

admin:~admin$ sudo python install

if u get gcc error then download the gcc from xcode tools
or else u have mac cds with u. In that keep 2nd cd in the disk and install the xcode tools from it.

4) please download the pyshell from here is the link....

5) copy the pyshell from downloaded to Library->Frameworks->Python.Framework->paste it.

6) Open the and close it.

7) now do the following step:

admin:~admin$ sudo python install

u will not get any gcc error.

8) open the idle from Python 2.5 or 2.6 not the python launcher.......

>>> import MySQLdb

u will get this it means MySQLdb was connected....

Keep enjoying.......
Feb 13 '09 #2

Post your reply

Sign in to post your reply or Sign up for a free account.