简体   繁体   中英

How to set LD_LIBRARY_PATH permanently

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 ?

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.

在您的 .bashrc 中添加以下行,该行可以在主目录中找到

export LIBRARY_PATH=/binaries/linux/x86_64

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM