Reputation: 107
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 ?
Upvotes: 3
Views: 12537
Reputation: 910
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.
Example:
# As root
echo "/usr/local/lib" >> /etc/ld.so.conf.d/onevpl.conf
echo "/usr/local/lib64" >> /etc/ld.so.conf.d/onevpl.conf
echo "/usr/local/lib/x86_64-linux-gnu" >> /etc/ld.so.conf.d/onevpl.conf
ldconfig
Upvotes: 7
Reputation: 94
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.
Upvotes: 7