2013年8月17日星期六

Python mysql 扩展问题的一些问题

      1. 由于mysql 的安装是自定义的目录,在源码安装 MySQL-python 的时候,需要指定mysql_config 的位置;
否则会报错:
cannot find -lmysqlclient_r

       后面指定了mysql 库文件位置 echo "/usr/local/mysql/lib/mysql" >> /etc/ld.so.conf
       还是报同样的错误。google 之
threadsafe
        thread-safe client library (libmysqlclient_r) if True (default);
        otherwise use non-thread-safe (libmysqlclient). You should
        always use the thread-safe library if you have the option;
        otherwise you *may* have problems.
修改 site.cfg 的另外一个配置 threadsafe   为false, 重新python install 后没有问题。

      2. 用rpm 的方式安装MySQL-python 同样会提示失败,这里必须要先安装mysql-lib rpm 包,复制 /usr/lib64 下的
lmysqlclient so 文件到指定的目录下,(我这里说的是源机器,如果是要简化的方法,直接copy 这个so 文件到指定的
位置,然后把动态lib 的位置写到 ldconfig 配置文件,使之生效即可。

没有评论:

发表评论