Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"my_config.h" file not found when install mysql-python on osx 10.8

Tags:

mysql-python

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.

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$  
like image 722
ninjaisun Avatar asked Aug 31 '12 15:08

ninjaisun


People also ask

Which command is use to install MySQL in Python?

Pip Command to install MySQL Connector python MySQL Connector Python is available on pypi.org, so you can install it using the pip command.

Is Python compatible with MySQL?

MySQL server and Python versions within parentheses are known to work with Connector/Python, but are not officially supported. Bugs might not get fixed for those versions. Connector/Python does not support the old MySQL Server authentication methods, which means that MySQL versions prior to 4.1 will not work.

How do I install MySQL on Python 3?

The easiest way to probably install and use MySQL in Python is to open up your command prompt. Once the command prompt is opened, then specify the full path to the Scripts folder of the Python package. Once you have this full path specified to the Scripts folder, then type in, pip install pymysql.


2 Answers

brew install mysql brew unlink mysql brew install mysql-connector-c sed -i -e 's/libs="$libs -l "/libs="$libs -lmysqlclient -lssl -lcrypto"/g' /usr/local/bin/mysql_config pip install MySQL-python brew unlink mysql-connector-c brew link --overwrite mysql 
like image 101
Nelson Tatius Avatar answered Sep 21 '22 07:09

Nelson Tatius


Works well on macOS High Sierra:

If you haven't already installed mysql: brew install mysql

brew unlink mysql brew install mysql-connector-c brew link --overwrite mysql pip install MySQL-python 
like image 44
Alexandr S. Avatar answered Sep 18 '22 07:09

Alexandr S.