0

I am new to ubuntu and python. When I run the command LD_LIBRARY_PATH , function works well.

***sudo LD_LIBRARY_PATH=/binaries/linux/x86_64 \
python3 /recognizer/main.py*** 

above works well. But when typing only python3 /recognizer/main.py , does not work. I want to set LD_LIBRARY_PATH permanently. How can I do that ?

3 Answers 3

4

You just need to add the following line to your ~/.bashrc file:

LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/binaries/linux/x86_64"

The file is loaded every time you open a terminal. If you want to set the variable once when you login, add the line to ~/.profile instead.

4

You can add that path to /etc/ld.so.conf (with sudo), or to a new file in /etc/ld.so.conf.d/ (if that directory exists). The second method has the advantage of being more organized compared to putting everything in one file.

After that, run sudo ldconfig. And then that library path will be added permanently for all users.

0

Add the following line in your .bashrc which can be found in home directory

export LIBRARY_PATH=/binaries/linux/x86_64
1
  • @KamalMahendraSirisena. Try re-opening the terminal and see if it works.
    – M. Zhang
    Jul 8, 2021 at 9:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.