37👍
I think you need to install the python development libraries first:
yum install python-devel
34👍
Just to mention for the others that might end up here too,
After installing python-devel, I had the very same error but with mysql_config.h missing
I solved this error in installing mysql-devel
$ yum install mysql-devel.x86_64
Hope this helps
- How do I create a proper user with django allauth?
- Differences between `class` and `def`
- How do I simulate connection errors and request timeouts in python unit tests
- Django-registration "remember me"
- How can I make SSE with Python (Django)?
- Django Serialize Queryset to JSON to construct RESTful response with only field information and id
- Django – forms.FileField() initial value
- When trying set corsheaders in settings.py file
- HTML input textbox in Django admin.py filter
1👍
I had the same error, but for different reasons (pypy + virtualenv).
Here is the error I got:
Installing collected packages: mysql-python
Found existing installation: MySQL-python 1.2.4
Uninstalling MySQL-python:
Successfully uninstalled MySQL-python
Running setup.py install for mysql-python
building '_mysql' extension
cc -O2 -fPIC -Wimplicit -Dversion_info=(1,2,4,'final',1) -D__version__=1.2.4 -I/usr/include/mysql -I/mnt/hgfs/Work/devel-centos/include -c _mysql.c -o build/temp.linux-x86_64-2.7/_mysql.o -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-strict-aliasing -fwrapv -fPIC -DUNIV_LINUX -DUNIV_LINUX
_mysql.c:29:20: error: Python.h: No such file or directory
Please note that the include_dir
is -I/mnt/hgfs/Work/devel-centos/include
(that’s $VIRTUAL_ENV/include
), and there is nothing at that location.
My setup:
- CentOS 6.4
pypy
2.0.2
installed (that’s python 2.7.3)-
virtualenv
1.10.1
installed and created my environment withvirtualenv -p /usr/bin/pypy devel-centos
-
python 2.6 is installed
yum install python-devel
did not solve the problem for me; it created/usr/lib64/python2.6/
which isn’t used during thepip install mysql-python
step.
2 ways to solve the problem:
-
symlink the correct python header files to your virtualenv:
yum install pypy-devel # which creates /usr/lib64/pypy-2.0.2/ ln -s /usr/lib64/pypy-2.0.2/include $VIRTUAL_ENV/include
-
or change the
setup.cfg
file formysql-python
pip install --no-install mysql-python
then edit
$VIRTUAL_ENV/build/mysql-python/setup.cfg
[build_ext] include_dirs = /usr/lib64/pypy-2.0.2/include
and proceed with the installation.
pip install --no-download mysql-python
- How to execute code on post_migrate signal in Django?
- Restricting all the views to authenticated users in Django
0👍
Same issue; Python.h not found,
Found that python-virtualenv was not installed;
yum -y install python-virtualenv