centOS install pycurl for python

1. Install libcurl

  1. Build your desired version of curl/libcurl in an alternate directory (I used /opt/curl) following the instructions here http://markus.revti.com/2009/12/install-rtorrent-using-curl-in-different-path-on-centos-linux/
  2. Grab the pycurl source for the appropriate libcurl version here http://pycurl.sourceforge.net/download/
  3. Run setup.py and tell it to build against your alternate libcurl, i.e.
    python setup.py install --curl-config=/opt/curl/bin/curl-config

2. Install pip via setup_tools

  1. install setup_tools, i.e.
    cd /usr/local/src
    wget http://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11-py2.7.egg
    sh setuptools-0.6c11-py2.7.egg --prefix=/opt/python2.7.1   <--- your python path
  2. install pip via easy_setup ,i.e
    /opt/python2.7.1/bin/easy_install pip
    ln -sf /opt/python2.7.1/bin/pip /usr/bin/pip
  3. install pycurl via pip ,i.e
    pip install pycurl --no-use-wheel --upgrade
  4. now you can try import pycurl if you still get an error about libcurl.so.4 , you should map LD_LIBRARY_PATH path , i.e find libcurl.so.4 path
    find / -name libcurl.so.4

    and map LD_LIBRARY_PATH path

    export LD_LIBRARY_PATH=$your_path_libcurl.so.4

Related posts:

This entry was posted in knowledge, python. Bookmark the permalink.