Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32k
Closed as not planned
Closed as not planned
Description
I add LD_LIBRARY_PATH to the python code like:
test.py
import osfrom ctypes import CDLLos.environ['LD_LIBRARY_PATH'] = "/home/test/myfolder/pyfolder/ztools1226/lib"print(os.environ)s_dll_path = f"/home/test/myfolder/pyfolder/ztools1226/lib/libCityPlanParse.so"dll_load = CDLL(s_dll_path)
I print the os.environ the LD_LIBRARY_PATH value already exists,but when I CDLL /home/test/myfolder/pyfolder/ztools1226/lib/libCityPlanParse.so report an error:
OSError: libCityPlanParse.so: cannot open shared object file: No such file or directory
But when I join in the command-line "export LD_LIBRARY_PATH=/home/test/myfolder/pyfolder/ztools1226/lib" before executing test.py,program execution ok.
So the environment variable I added in the code is not take effect.But I need to do that.How can I write about it to take effect?
My environment
python 3.8.3
Linux system