Is there a way to set specify during runtime where Python looks for shared libraries?
I have fontforge.so
located in fontforge_bin
and tried the following
os.environ['LD_LIBRARY_PATH']='fontforge_bin'
sys.path.append('fontforge_bin')
import fontforge
and get
ImportError: fontforge_bin/fontforge.so: cannot open shared object file: No such file or directory
Doing ldd
on fontforge_bin/fontforge.so
gives the following
linux-vdso.so.1 => (0x00007fff2050c000)
libpthread.so.0 => /lib/libpthread.so.0 (0x00007f10ffdef000)
libc.so.6 => /lib/libc.so.6 (0x00007f10ffa6c000)
/lib64/ld-linux-x86-64.so.2 (0x00007f110022d000)
export LD_LIBRARY_PATH=fontforge_bin
before running the script, now I want to set this from inside the script – Durwardsys.path.append
was the right way, and as you can see from the error message it did try to open it. I suggest that you use the full path name of the directory, rather than a relative one. – Isotropic