您的位置:首页 > 移动开发 > Objective-C

Error loading MySQLdb module: libmysqlclient_r.so.16: cannot open shared object file: No such file or directory

2010-02-05 11:44 981 查看
装python + apache + django过程中真是一个问题加一个问题啊,刚刚解决完一个,又来一个

Error loading MySQLdb module: libmysqlclient_r.so.16: cannot open shared object file: No such file or directory

后来上网找了半天 看到 http://sourceforge.net/projects/mysql-python/forums/forum/70461/topic/3450226
有这么一个回复

nstead of changing your LD_LIBRARY_PATH you should set
"runtime_library_dirs" to point to your library path on the destination
system in the setup_posix.py

before
compiling.

eg. like this:

Code:
ext_options = dict(
name = "_mysql",
library_dirs = library_dirs,
runtime_library_dirs = library_dirs,
libraries = libraries,
extra_compile_args = extra_compile_args,
include_dirs = include_dirs,
extra_objects = extra_objects,
define_macros = define_macros,
)
return metadata, ext_options


尝试之,未果,又在JAVAEYE一个关于C连MYSQL的错误的文章中看到 这样的描述 在Linux下C连接MySQL出现问题如下:

  编译成功后,运行程序,出现./connect: error while loading shared libraries:

libmysqlclient.so.15: cannot open shared object file: No such file or directory.

  出现上面的错误是因为系统运行的时候没有找到程序运行所需要的libmysqlclient.so.15运行库文件,解决方法有两个:

  方法一:直接把libmysqlclient.so.15这个文件拷贝到系统指定的/usr/lib库文件目录中。

 方法二:设置/etc/ld.so.conf文件,编辑该文件,在文件中加入libmysqlclient.so.15所在目录,保存退出。

需要注意的是,每次改动ld.so.conf之后需要运行ldconfig来确认刷新。

  方法三:Add /usr/local/mysql/lib/mysql to you LD_LIBRARY_PATH environment variable

于是得到启发,按照上面的方法一试,OK,通过!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐