xuweili

刚刚安装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

分类:

技术点:

相关文章:

  • 2021-12-02
  • 2021-05-31
  • 2021-09-17
  • 2022-01-28
  • 2021-04-22
  • 2021-12-04
  • 2021-09-28
猜你喜欢
  • 2021-12-02
  • 2021-09-17
  • 2021-08-17
  • 2021-09-17
  • 2022-12-23
  • 2021-09-17
  • 2021-06-09
相关资源
相似解决方案