Finding .so files without setting LD_LIBRARY_PATH

Lawrence D’Oliveiro lawrencedo99 at gmail.com
Thu Jun 2 01:57:47 EDT 2016


On Thursday, May 12, 2016 at 9:51:02 AM UTC+12, Paul Smith wrote:
> ... here's the problem: because LD_LIBRARY_PATH is in
> Python's environment it is also passed down to programs invoked by
> Python.  That means if I (for example) invoke subprocess.call(['ssh',
> ...]) then it fails because the system ssh is looking for the system
> libcrypto.so, and when it finds the Python libcrypto.so instead
> (because of LD_LIBRARY_PATH) it fails.

That’s easy enough to fix: you can pass a custom environment down to subprocesses by using the “env” argument to the various subprocess calls <https://docs.python.org/3/library/subprocess.html>.



More information about the Python-list mailing list