Heim  >  Artikel  >  Datenbank  >  在Python安装MySQL支持模块的方法_MySQL

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

WBOY
WBOYOriginal
2016-06-01 13:25:201249Durchsuche

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
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn