Saturday, November 9, 2013

ImportError: cannot open shared object file

Share at Facebook

I have encountered this error at my CentOS server while using the pycurl from the Python.

ImportError: cannot open shared object file: No such file or directory

Python basically searches the paths for dynamic libraries which are only defined at the environment variable LD_LIBRARY_PATH. For example in my case, the library is located at the path /usr/local/lib and its not defined at the env varaible LD_LIBRARY_PATH. So I have added the path on it, and worked.

You can add the path to the variable by any of the following ways.

export LD_LIBRARY_PATH=/usr/local/lib

or, if you want to keep the previously set variables are intact, then

export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH

No comments: