Confusing, desparate MySQLdb problems...

Ned Deily nad at
Sun Jan 17 02:54:01 CET 2010

In article 
<8647768b-944c-4025-8389-768a9cae587c at>,
 stopchuckingstuff <stopchuckingstuff at> wrote:
> On Jan 17, 12:14 am, Ned Deily <nad at> wrote:
> > In article
> > <0ba7faf8-f816-4100-ba5b-b138d3008b29 at>,
> >  stopchuckingstuff <stopchuckingstuff at> wrote:
> > > I have installed MySQLdb on Mac OSX 10.6.2, and have it working when
> > > running on my system in IDLE and in terminal, however encounter
> > > continual problems when running it through Apache.
> > > When trying to import the module, it gives me this error:
> > > <type 'exceptions.ImportError'>: /Library/WebServer/.python-eggs/
> > > MySQL_python-1.2.3c1-py2.6-macosx-10.3-fat.egg-tmp/ no
> > > appropriate 64-bit architecture (see "man python" for running in 32-
> > > bit mode) [...]
> > Most likely possibility: you've installed another Python on 10.6,
> > probably from, which only runs in 32-bit mode while Apache is
> > using the Apple-supplied Python 2.6.1 which, by default, runs in 64-bit
> > mode. [...]
> Thanks very much - I think this must be the problem (which python
> produces some long path to Python 2.6). Ideally, I'd like to change
> Apache's path to python as I had such problems installing MySQLdb -
> would you have any idea how to do it?
> Sorry for the repeat posts, but would it be to do with the first line
> of all my scripts - #!/usr/bin/env python?

/usr/bin/env python will cause the first command named python in the 
process's execution path ($PATH) to be used.  Apache is probably not 
running under your user name and does not have the PATH modification in 
your .bash_profile to stick that long path to the Python 2.6 
bin directory at the front of $PATH.   Rather than changing Apache's 
startup, the easier solution would probably be to modify your scripts to 
point at the desired python.  By default, the installers put 
a link to that python in /usr/local/bin so it may be easier to use a 
shebang line like:


 Ned Deily,
 nad at

More information about the Python-list mailing list