Install Mysql-python steps on Mac OS:
1. Download MySQL, also known as MySQL Community Server, download version 10.9 can be (according to the system version download), slow on the Baidu disk to find
http://dev.mysql.com/downloads/mysql/
2. Install Mysql-python, a set of APIs that Python calls MySQL, not a MySQL database
Method 1: The command line is lowered by:
sudo easy_install Mysql-python
Method 2: Directly from the online next to the latest, because it is Python code, so do not control whether the DMG or ZIP or tag what format, anyway can run. We recommend getting a copy of the latest code from GitHub.
https://github.com/farcepest/MySQLdb1/
I was under a version of 1.2.5.
https://github.com/farcepest/MySQLdb1/tree/MySQLdb-1.2.5
3. Installation Mysql-python prompt error environmenterror:mysql_config not found
Unzip into the Mysql-python directory, there is a site.cfg, open this configuration file.
Remove the mysql_config in front of you, #表示注释
Modify the MySQL installation directory, if the download is DMG automatic installation is here
Mysql_config =/usr/local/mysql/bin/mysql_config
Then the command line input
sudo python setup.py buildsudo python setup.py install
4. When running Python, report MySQL driver problem:Library not loaded:libmysqlclient.18.dylib
The cause of the error is the newly compiled installation of Lib placed under Mysql_home/lib, the terminal can not find this location, the solution is to do a soft link link to/usr/lib under
sudo ln-s/usr/local/mysql/lib/libmysqlclient.18.dylib/usr/lib/libmysqlclient.18.dylib
You need to run the above command, or there will be errors in the program running.
Perfect Harvest!
MAC os10.9 Mysql-python Installation