Method to install the MySQL support module in Python
- 2020-05-30 21:11:35
- OfStack
I have just installed Python's MySQL support library, and I have encountered a series of problems. Fortunately, all of them have been solved under Google1. So write it down, memo.
1. Download Python's 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, the editor setup_posix py file, will mysql_config. path set to you install directory of mysql, such as/usr local/mysql/bin/mysql_config
3. In python, "import MySQLdb", there are problems:
ImportError: libmysqlclient_r.so.16: cannot open shared object file: No such file or directory
Solution, edit/etc/ld so. conf. d/mysql - i386. conf file
To correct mysql installation address, such as: I usr local/mysql/lib/mysql
Exit after saving and execute ldconfig
4. Knock it off
1. Download Python's 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, the editor setup_posix py file, will mysql_config. path set to you install directory of mysql, such as/usr local/mysql/bin/mysql_config
3. In python, "import MySQLdb", there are problems:
ImportError: libmysqlclient_r.so.16: cannot open shared object file: No such file or directory
Solution, edit/etc/ld so. conf. d/mysql - i386. conf file
To correct mysql installation address, such as: I usr local/mysql/lib/mysql
Exit after saving and execute ldconfig
4. Knock it off