This article will introduce you in detail to anyone who needs to know about installing the MySQL support module in Python.
After installing the MySQL support library for Python, I encountered a series of problems at one time. Fortunately, Google solved them all. Record it and forget it.
1. Download the Python MySQL support library
Address: http://sourceforge.net/projects/mysql-python/
2. decompress and compile
Python setup. py install
The first problem:
_ Mysql. c: 44: 23: error: my_config.h: No such file or directory
Solution: edit the setup_posix.py file and set mysql_config.path to the directory of your installed mysql, such as/usr/local/mysql/bin/mysql_config.
3. "import MySQLdb" in python. Problems:
ImportError: libmysqlclient_r.so.16: cannot open shared object file: No such file or directory
Work und, edit the/etc/ld. so. conf. d/mysql-i386.conf File
Change to the correct mysql installation address, for example, usr/local/mysql/lib/mysql.
Save the disk and exit. Run ldconfig
4. Complete the work.