I face this problem when I want to install mysql-python on osx 10.8, it show error with 'my_config.h' file not found. Anyone can help me on that, I am very appreciate on what your contributing, thanks.
Below is my running code:
sudo easy_install mysql-python
Password:
Searching for mysql-python
Reading http://pypi.python.org/simple/mysql-python/
Reading http://sourceforge.net/projects/mysql-python/
Reading http://sourceforge.net/projects/mysql-python
Best match: MySQL-python 1.2.3
Downloading http://pypi.python.org/packages/source/M/MySQL-python/MySQL-python-1.2.3.tar.gz#md5=215eddb6d853f6f4be5b4afc4154292f
Processing MySQL-python-1.2.3.tar.gz
Running MySQL-python-1.2.3/setup.py -q bdist_egg --dist-dir /tmp/easy_install-UoZlf7/MySQL-python-1.2.3/egg-dist-tmp-phaQqE
warning: no files found matching 'MANIFEST'
warning: no files found matching 'ChangeLog'
warning: no files found matching 'GPL'
clang: warning: argument unused during compilation: '-mno-fused-madd'
_mysql.c:36:10: fatal error: 'my_config.h' file not found
#include "my_config.h"
^
1 error generated.
error: Setup script exited with error: command 'clang' failed with exit status 1
ninjaiimac:MySQL-python-1.2.3 sunninjaisun$
please try:
Works well on macOS High Sierra:
If you haven't already installed mysql:
brew install mysql
I used
brew
to install everything on Mac OS 10.14.2.The other answers weren't working for me, when inside of a virtual environment (
virtualenv
) on Mojave. I followed Jofsey's instructions but got errors:So, after I ran those commands, I ran this as the final command and it worked:
My problem was that I was using MAMP's version of mysql and it didn't contain the dev headers. I downloaded the dmg of the official release and had it running in no time.
As mentioned before, you need the dev headers for MySQL, which don't come with MAMP by default. Rather than using two instances of MySQL, it's possible to add the headers to the MAMP version. There are good instructions for doing so here: http://dreamconception.com/tech/how-to-install-mysqldb-mysql-python-on-mamp/
Make sure not to just copy-paste all the commands, they're a bit out of date so you'll need to change the version numbers in some of them.
I'm using OS X 10.9 and python 2.7, and everything works.