gcc error Python.h: No such file or directory

9,061

AHA!

It was because I'd installed python2.7 alongside the system python2.6 (following this great page). I had to be careful that I referenced the right python (see this) and from this I discovered my problem: python27-devel instead of python-devel was needed. Ah, ignorance.

Here's the final thing I ran.

sudo yum install mysql mysql-devel mysql-libs 
sudo yum install python27-devel
sudo yum install MySQL-python 
sudo pip install mysql-python
Share:
9,061

Related videos on Youtube

ehacinom
Author by

ehacinom

Updated on September 18, 2022

Comments

  • ehacinom
    ehacinom over 1 year

    I have python-dev (or, as I'm on Centos, python-devel) already installed.

    sudo yum install mysql mysql-devel mysql-libs 
    sudo yum install python-devel
    sudo yum install MySQL-python 
    

    How come this command cannot find the Python.h header file?

    sudo pip install mysql-python
    

    Before, I upgraded python from 2.6 to 2.7. find / -name Python.h 2>/dev/null returns /usr/include/python2.6/Python.h, which python returns /usr/bin/python, and which gcc returns /usr/bin/gcc.

    • ehacinom
      ehacinom over 9 years
      @ssnobody, Usage: /usr/lib64/mysql/mysql_config [OPTIONS] and the Options