title: Set LD_LIBRARY_PATH before importing in python
body: <p>Python uses the <code>PYTHONPATH</code> environment-variable to determine in which folders it should look for modules.
  You can play around with it by modifying <code>sys.path</code>, which works nicely for pure Python-Modules.
  But when a module uses shared object files or static libraries, it looks for those in <code>LD_LIBRARY_PATH</code> (on linux), but this can't be changed as easily and is platform dependent as far as I know.</p>
  <p>The quick-fix for this problem is of course to set the environment-variable or invoke the script like <code>LD_LIBRARY_PATH=. ./script.py</code>, but then you'll have to set it again for every new shell you open.
  Also, the <code>.so</code> files in my case will always be in the same directory as the <code>.py</code> file, but may very well be moved to another absolute path, so I'd like to set them automatically every time I invoke the script.</p>
  <p><em>How can I edit the path in which the Python interpreter looks for libraries platform-independently on runtime?</em></p>
  <h3>EDIT:</h3>
  <p>I already tried <code>os.environ['LD_LIBRARY_PATH'] = os.getcwd()</code>, but to no avail.</p>