Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

ubuntu 11.04 has native python2.7 i build python2.5 from source to /usr/local/python2.5/bin, and try to install mysqldb for my custom python2.5 install. Also i use virtualenv. I switch to my env with python2.5

And do:

pip install MySQL-python

this raise error:

pymemcompat.h:10:20: error: Python.h: No such file or directory

for python2.7 pip install MySQL-python work fine, but for python2.5 not.

Also i install:

sudo apt-get install python-dev libmysqlclient15-dev

but this don't help.

How can i fix this error?

share|improve this question

migrated from stackoverflow.com Jul 24 '11 at 10:08

This question came from our site for professional and enthusiast programmers.

The error on missing Python.h usually means that the compiler can't find the path to your python (in this case python 2.5) include files.

share|improve this answer

Download mysqldb extension by hand and before running python setup.py install do this

export CFLAGS=-I/usr/local/python2.5/include

I am not 100% sure about include directory but go to your local python installation and find include directory there.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.