pip install mysql-python fails with EnvironmentError: mysql_config not found
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
and get $2,000 discount on your first invoice
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Unforgiving Himalayas Looping
--
Chapters
00:00 Pip Install Mysql-Python Fails With Environmenterror: Mysql_config Not Found
01:20 Accepted Answer Score 1604
01:55 Answer 2 Score 324
02:19 Answer 3 Score 106
02:29 Answer 4 Score 109
02:45 Thank you
--
Full question
https://stackoverflow.com/questions/5178...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #pip #mysqlpython
#avk47
ACCEPTED ANSWER
Score 1604
It seems mysql_config is missing on your system or the installer could not find it. Be sure mysql_config is really installed.
For example on Debian/Ubuntu you must install the package:
sudo apt-get install libmysqlclient-dev
Maybe the mysql_config is not in your path, it will be the case when you compile by yourself the mysql suite.
Update: For recent versions of debian/ubuntu (as of 2018) it is
sudo apt install default-libmysqlclient-dev
ANSWER 2
Score 324
In Mac OS, I simply ran this in terminal to fix:
export PATH=$PATH:/usr/local/mysql/bin
This is the quickest fix I found - it adds it to the path, but I think you're better off adding it permanently (ie add it to /etc/paths) if you plan to install MySQL-python in another environment.
(tested in OSX Mountain Lion)
ANSWER 3
Score 109
There maybe various answers for the above issue, below is a aggregated solution.
For Ubuntu:
$ sudo apt update
$ sudo apt install python-dev
$ sudo apt install python-MySQLdb
For CentOS:
$ yum install python-devel mysql-devel
ANSWER 4
Score 106
apt-get install libmysqlclient-dev python-dev
Seemed to do the trick.