Home > Database > Mysql Tutorial > body text

安装MySQLdb-python时无法找到-lprobes_mysql处理一则_MySQL

WBOY
Release: 2016-06-01 13:29:39
Original
934 people have browsed it

python

bitsCN.com

安装MySQLdb-python时无法找到-lprobes_mysql处理一则

 

安装MySQLdb时,我已经做好了如下两点:

1)配置好mysql_config

    有两种方式可以做:

    ① 做个软连接,把mysql_config链接到/usr/local/bin下

    ② 修改site.cfg配置,把里面的mysql_config指向$MYSQL_HOME/bin/mysql_config

   

2)配置动态链接库:把$MYSQL_HOME/mysql/lib写到/etc/ld.so.conf里面,然后ldconfig生成cache

 

 

以为只欠东风的时候还是阴沟里翻了,执行:python setup.py install 报错如下:

[plain] 

gcc -pthread -shared build/temp.linux-i686-2.7/_mysql.o -L/home/mysql/mysql/lib -lmysqlclient -lpthread -lprobes_mysql -lz -lm -lrt -ldl -o build/lib.linux-i686-2.7/_mysql.so  

/usr/bin/ld: cannot find -lprobes_mysql  

collect2: ld 返回 1  

error: command 'gcc' failed with exit status 1  

 

以为源码问题,改用Python包管理器安装:pip install MySQLdb-python 但是报lprobes_mysql无法找到,,蛋裂ing

 

后来怀疑是gcc问题,毕竟有"error: command 'gcc' failed with exit status "

于是通过本地yum源打上了mysql-devel,还以为终于可以收手了,哎,错误依旧!!

 

回到关键点上"/usr/bin/ld: cannot find -lprobes_mysql"

细心分析,我们知道,ld是共享库加载器,但共享库的配置我在2)里面已经做了

没有道理ld 找不到,除非只有一种可能,那就是本来就没有,让ld 怎么找呢??

 

因为我的mysql是源码编译安装的,CMAKE没有指定-DENABLE_DTRACE=OFF 选项[缺省是ON]

但要重装mysql??臣妾做不到啊。。。

 

最后在bugs.mysql.com里面从某个外国人的评论当中得到启发

把mysql_config里面的第112行 libs 键值里面的 -lprobes_mysql去掉,再运行 python setup.py install

成功!

 

如果您的mysql是二进制安装或者直接rpm安装,可能不存在我这个问题

 

bitsCN.com
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!