下載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
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 “<stdin>”, line 1, in ?
ImportError: No module named pycurl
</stdin>
檢查一下,原來是pycurl自己假定的curl路徑不對。
需要給pycurl指定curl-config 路徑,如下所示:
python setup.py install –curl-config=/usr/local/bin/curl-config
問題很小,有點隱蔽
相關報錯:
File "", line 1, in
ImportError: libcurl.so.4: cannot open shared object file: No such file or directory
提示錯誤,解決方法:
export LD_LIBRARY_PATH=/usr/local/lib
or
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH