Python Forum
How to set LD_LIBRARY_PATH on python codes?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to set LD_LIBRARY_PATH on python codes?
#1
I am using eclipse ide. So I configure LD_LIBRARY_PATH environment variable on eclipse ide. But I try to generate python codes which are independent on development ide. I want to generate codes which export environment variables on python codes dynamically. These are my sample codes.

import os, sys
import subprocess

my_env = os.environ.copy()
my_env["LD_LIBRARY_PATH"] = "/home/joseph/hadoop/lib/native"

subprocess.Popen('export', env=my_env)
But these codes throws exception,

Error:
FileNotFoundError: [Errno 2] No such file or directory: 'export'
I also try to execute
os.execv('export', ['LD_LIBRARY_PATH'])
But fail again.
Kindly inform me how to configure LD_LIBRARY_PATH variable on python codes. Best regards.
Reply
#2
did you try just
os.environ["LD_LIBRARY_PATH"] = "/home/joseph/hadoop/lib/native"
as per the docs:
Quote:This mapping may be used to modify the environment as well as query the environment. putenv() will be called automatically when the mapping is modified.
aupres likes this post
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to load log.txt directly into python codes? sparkt 6 2,996 Aug-21-2020, 03:51 PM
Last Post: sparkt
  Python 3 escape codes oldDog 1 2,603 Sep-15-2018, 10:12 AM
Last Post: gruntfutuk
  Sending different color codes in python at certain times Kimzer 4 3,442 Jun-18-2018, 06:56 PM
Last Post: gontajones

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020