安装完mysql-python后import加载模块 ImportError: libmysqlclient_r.so.16

安装完mysql-python后import加载模块提示以下错误,
ImportError: libmysqlclient_r.so.16: cannot open shared object file: No such file or directory


于是google之,总结一下解决方法:

将mysql/lib下所有关于libmysqlclient的so文件软链接到/usr/lib下。

ln -s /usr/local/mysql/lib/mysql/libmysqlclient* /usr/lib
ldconfig

这样 import MySQLdb 的时候就不会出错了


附安装MySQLdb方法

  • install setuptools

wget -q http://peak.telecommunity.com/dist/ez_setup.py

python ez_setup.py

  • install Mysql-pthon

  $ tar xfz MySQL-python-1.2.1.tar.gz
  $ cd MySQL-python-1.2.1
  $ # edit site.cfg if necessary
  $ python setup.py build
  $ sudo python setup.py install # or su first

你可能感兴趣的:(python,object,File,Google,Build,import)