title: Python not finding library in /usr/lib/x86_64-linux-gnu that ldconfig -p does find
body: <p>I'm trying to use the python module cairocffi. I use Debian (Stretch) on x86-64, so I installed the apt package <code>libcairo2-dev</code> and installed the <code>cairocffi</code> python package using pip. This all went well. But when I try to import it, it fails to load the module:</p>
  
  <pre><code>$ python -c "import cairocffi; print('OK')"
  Traceback (most recent call last):
    File "&lt;string&gt;", line 1, in &lt;module&gt;
    File "/usr/local/lib/python2.7/dist-packages/cairocffi/__init__.py", line 46, in &lt;module&gt;
      cairo = dlopen(ffi, 'cairo', 'cairo-2')
    File "/usr/local/lib/python2.7/dist-packages/cairocffi/__init__.py", line 43, in dlopen
      raise OSError("dlopen() failed to load a library: %s" % ' / '.join(names))
  OSError: dlopen() failed to load a library: cairo / cairo-2
  </code></pre>
  
  <p>However, <code>ldconfig</code> does know about <code>libcairo.so</code>:</p>
  
  <pre><code>$ sudo ldconfig -p | grep cairo
          libpangocairo-1.0.so.0 (libc6,x86-64) =&gt; /usr/lib/x86_64-linux-gnu/libpangocairo-1.0.so.0
          libpangocairo-1.0.so (libc6,x86-64) =&gt; /usr/lib/x86_64-linux-gnu/libpangocairo-1.0.so
          libcairo.so.2 (libc6,x86-64) =&gt; /usr/lib/x86_64-linux-gnu/libcairo.so.2
          libcairo.so (libc6,x86-64) =&gt; /usr/lib/x86_64-linux-gnu/libcairo.so
          libcairo-script-interpreter.so.2 (libc6,x86-64) =&gt; /usr/lib/x86_64-linux-gnu/libcairo-script-interpreter.so.2
          libcairo-script-interpreter.so (libc6,x86-64) =&gt; /usr/lib/x86_64-linux-gnu/libcairo-script-interpreter.so
          libcairo-gobject.so.2 (libc6,x86-64) =&gt; /usr/lib/x86_64-linux-gnu/libcairo-gobject.so.2
          libcairo-gobject.so (libc6,x86-64) =&gt; /usr/lib/x86_64-linux-gnu/libcairo-gobject.so
  </code></pre>
  
  <p>and when I run python with a modified <code>LD_LIBRARY_PATH</code>, it works:</p>
  
  <pre><code>$ LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu python -c "import cairocffi; print('OK')"
  OK
  </code></pre>
  
  <p>I don't want to have to run python on a modified <code>LD_LIBRARY_PATH</code> to run this script for the sake of scalability and maintainability, but I can't figure out why it isn't picking up the library that apparently the dynamic linker does know about. What am I missing?</p>