fix pycurl link error

install pycurl with pip, but failed to import it, the error as follow

import pycurl
ImportError: pycurl: libcurl link-time ssl backend (nss) is different from compile-time ssl backend (none/other)

try

pip uninstall pycurl
export PYCURL_SSL_LIBRARY=[openssl|gnutls|nss] #错误中显示是 nss 则换成 nss
pip install pycurl

But not work.
refer the follows on http://stackoverflow.com/questions/21096436/pip-install-pycurl-ssl-backend-error
install pycurl with a source code and set a flag
(Note: the original pycurl should be remove by pip first)

sudo python setup.py --with-nss install

done~!

p.s.
can download pycurl at https://github.com/pycurl/pycurl

another case:
run sudo pip install pycurl, and get the following error message:

Installing collected packages: pycurl Running setup.py install for
pycurl
….
building ‘pycurl’ extension
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/src
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DPYCURL_VERSION=”7.19.5.1” -DHAVE_CURL_OPENSSL=1 -DHAVE_CURL_SSL=1 -I/usr/local/include/python2.7 -c src/docstrings.c -o build/temp.linux-x86_64-2.7/src/docstrings.o
在包含自 src/docstrings.c:4 的文件中:
src/pycurl.h:59:4: 错误:#error “Need libcurl version 7.19.0 or greater to compile pycurl.”
error: command ‘gcc’ failed with exit status 1
….

get a curl package with a greater version from http://curl.haxx.se/download/ and install,
then sudo pip install pycurl done! and no error when import pycurl in python
if failed to import pycurl again, note that there are more than one libcurl.so in system, find them out and check the *.so path in /etc/ld.so.conf

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值