pycurl对libcurl版本有要求,需先升级curl
下载curl
wget http://curl.haxx.se/download/curl-7.21.3.tar.gz
tar xzvf curl-7.21.3.tar.gz
cd curl-7.21.3
./configure #假若指定路径后面安装pycurl也同样需要指定curl-config路径,指到文件
make
make install
下载pycurl
wget http://pycurl.sourceforge.net/download/pycurl-7.19.0.tar.gz
tar xzvf pycurl-7.19.0.tar.gz
cd pycurl-7.19.0
python setup.py install
一切顺利,一个错误都没有提示,但运行python之后,出了问题
import pycurl
提示如下错误
Traceback (most recent call last):
File “”, line 1, in ?
ImportError: No module named pycurl
检查一下,原来是pycurl自己假定的curl路径不对。
需要给pycurl指定curl-config 路径,如下所示:
python setup.py install –curl-config=/usr/local/bin/curl-config
相关报错:
Traceback (most recent call last):
File "", line 1, in
ImportError: libcurl.so.4: cannot open shared object file: No such file or directory
或者
Traceback (most recent call last):
File "", line 1, in
ImportError: pycurl: libcurl link-time version (7.19.7) is older than compile-time version (7.37.0)
提示错误,解决方法:
export LD_LIBRARY_PATH=/usr/local/lib
or
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
阅读(4892) | 评论(0) | 转发(0) |