您的位置:首页 > 其它

fix pycurl link error

2015-08-29 14:35 330 查看
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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: