Menu

Can't find Python.h when building MySQLdb OSX

Help
Anonymous
2009-01-31
2012-09-19
  • Anonymous

    Anonymous - 2009-01-31

    When I run 'sudo python setup.py build', I get error: 'pymemcompat.h:10:20: error: Python.h: No such file or directory'

    Can some help?

    • I downloaded the MySQL-python1.2.2. I've already performed the suggested modifications to '_mysql.c' (removing the unint) and set Threadsafe=False in 'site.cfg'.

    But I still get an error finding Python.h.

    • I'm on Leopard 10.5. I have XCode installed (gcc 4.0.1). I'm using pre-installed Python 2.5. I have MySQL-python 1.2.2.

    SOME ENVIRONMENT INFO:

    Macintosh-10:bin MYUSERNAME $ which Python
    Python is /usr/bin/Python
    Macintosh-10:bin MYUSERNAME $ python
    Python 2.5.1 (r251:54863, Apr 15 2008, 22:57:26)
    [GCC 4.0.1 (Apple Inc. build 5465)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>> exit()
    Macintosh-10:bin MYUSERNAME $ which gcc
    gcc is /usr/bin/gcc
    Macintosh-10:bin MYUSERNAME $ gcc
    i686-apple-darwin8-gcc-4.0.1: no input files
    Macintosh-10:bin MYUSERNAME $ path
    /usr/local/bin
    /usr/local/sbin
    /usr/local/mysql/bin
    /opt/local/bin
    /opt/local/sbin
    /bin
    /sbin
    /usr/bin
    /usr/sbin

    FULL ERROR STACK:

    Macintosh-10:MySQL-python-1.2.2 MYUSERNAME$ sudo python setup.py 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
    deleting MySQL_python.egg-info/native_libs.txt
    reading manifest file 'MySQL_python.egg-info/SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    writing manifest file 'MySQL_python.egg-info/SOURCES.txt'
    installing library code to build/bdist.macosx-10.5-i386/egg
    running install_lib
    running build_py
    copying MySQLdb/release.py -> build/lib.macosx-10.5-i386-2.5/MySQLdb
    running build_ext
    building '_mysql' extension
    gcc -fno-strict-aliasing -Wno-long-double -no-cpp-precomp -mno-fused-madd -fno-common -dynamic -DNDEBUG -g -Os -Wall -Wstrict-prototypes -DMACOSX -I/usr/include/ffi -DENABLE_DTRACE -pipe -Dversion_info=(1,2,2,'final',0) -Dversion=1.2.2 -I/usr/local/mysql/include -I/System/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5 -c _mysql.c -o build/temp.macosx-10.5-i386-2.5/_mysql.o -Os -arch i386 -fno-common
    In file included from _mysql.c:29:
    pymemcompat.h:10:20: error: Python.h: No such file or directory
    _mysql.c:30:26: error: structmember.h: No such file or directory

    -Mike

     
    • Andy Dustman

      Andy Dustman - 2009-02-01

      You don't have Python development files installed, or they aren't where setuptools/distutils expects to find them.

       
      • Anonymous

        Anonymous - 2009-02-01

        I've switch to sqlite instead. Getting mysql_python up was just too much to deal with.

        Regardless, doesn't Leopard come with python development tools standard? If not, where does one install them from.

        Thanks though for your response.

         

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.