mac mysql安装sll_python mac下安装 MySQLdb模块的坑 library not found for -lssl

今天继续安装mysql模块,参考以往的思路,继续度娘,下载mysqldb的包,解压,在里面执行python setup.py install

结果总是那么不顺利(否则也不会有这篇文章了),关于要配置mysql_config那个就不说了,下面划重点

出现的问题:

cc -bundle -undefined dynamic_lookup -arch i386 -arch x86_64 -Wl,-F. build/temp.macosx-10.11-intel-2.7/_mysql.o -L/usr/local/Cellar/mysql/5.7.14/lib -lmysqlclient -lssl -lcrypto -o build/lib.macosx-10.11-intel-2.7/_mysql.so

ld: library not found for -lssl

clang:error:linker command failed with exit code 1 (use -v to see invocation)

error: command 'cc' failed with exit status 1

碰到这个问题,我以为只是某个lssl包没有,然后傻乎乎的去brew search lssl,发现没有,然后去问度娘,找到了一篇关于 ld: library not found for -lssl 的,

http://stackoverflow.com/questions/19652877/installing-saltstack-at-os-x-error-ld-library-not-found-for-lssl

这里有个哥们说了

86367222dd74

缺少libssl

缺少libssl,需要安装。我一开始也是怀着际动的心情去 brew search libssl ,没有!懵逼一下,

然后再问了下度娘libssl,发现它是openssl里的,而我本地的openssl已经有安装。于是回过头来继续看发现有一句重点我没详看:

You didn't include the link to the tutorial you are using at the top of your question. The link you created would not work, you need to link to the directory that contains either libssl.a or libssl.dylib. Better yet, change that -L parameter to search the correct location of your ssl library.

安装的时候没有引用这个链接,然后继续访问下面那个哥们留的那个地址,关于类似问题的解决方案:

http://stackoverflow.com/questions/26288042/error-installing-psycopg2-library-not-found-for-lssl/39244687#39244687

这篇文章里有类似这样的话

you could also try to link against brew's openssl:

env LDFLAGS="-I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib"pip install psycopg2

到这里,我心里大概有点明白了,我执行安装的时候,需要把openssl/lib的路径链接上去,我去找了下openssl路径,确实是/usr/local/opt/openssl/lib/,而且里面确实有 libssl.a和libssl.dylib两个文件。

然后 执行

env LDFLAGS="-I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib" python setup.py install

安装成功!

这个问题困扰了我一中午,有时候还是得看老外说的(英语不好的表示很心塞)。感谢stackoverflow!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值