Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

2 Answers 2

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

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

Your Answer

 
discard

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