Home > Database > Mysql Tutorial > body text

在Python安装MySQL支持模块的方法_MySQL

WBOY
Release: 2016-06-01 13:25:20
Original
1292 people have browsed it

python

bitsCN.com 刚安装Python的MySQL支持库,一口气遇到了一连串的问题,好在Google一下,均解决。遂记录下,备忘。

1.下载Python的MySQL支持库

地址:http://sourceforge.net/projects/mysql-python/

2.解压编译

python setup.py install

遇到第一个问题:

_mysql.c:44:23: error: my_config.h: No such file or directory

解决办法,编辑setup_posix.py文件,将mysql_config.path设置成你安装的mysql的目录,比如/usr/local/mysql/bin/mysql_config

3.在python中"import MySQLdb",遇到问题:

ImportError: libmysqlclient_r.so.16: cannot open shared object file: No such file or directory

解决办法,编辑/etc/ld.so.conf.d/mysql-i386.conf文件

改成正确的mysql安装地址,比如我的:usr/local/mysql/lib/mysql

存盘后退出,执行ldconfig

4.搞定,打完收工bitsCN.com
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!