Recently began to learn Python, in the installation of MYSQLDB encountered problems, card for a long time, decided to write down to deepen the memory, but also to the vast number of monkeys just learning Python also added a little reference value.
1. Enter python into the terminal import MYSQLDB if there is an error: Importerror:no module name MYSQLDB indicates no installation mysqldb
2. Install mysqldb access Https://pypi.python.org/pypi/MySQL-python to download the appropriate installation package for you.
3. Use the terminal CD to enter the folder, call the command $ python setup.py install, if into error: Environmenterror:mysql_config not found. First find the location of the Mysql_config,
In the terminal call $ locate mysql_config, (the landlord's location is/usr/local/bin/mysql_config) and then locate the setup_posix.py file under the Mysql-python resource file: Mysql_ in the file Config.path change its value to:/usr/local/bin/mysql_config (the location of your mysql_config),
4. Call $ python setup.py install ,成功了!!!
5.$ Python
$ import mysqldb done.
Python installation MySQLdb