Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
573 views
in Technique[技术] by (71.8m points)

linux - 如何在linux中设置环境变量LD_LIBRARY_PATH(How to set the environmental variable LD_LIBRARY_PATH in linux)

I have first executed the command: export LD_LIBRARY_PATH=/usr/local/lib

(我先执行了命令: export LD_LIBRARY_PATH=/usr/local/lib)

Then I have opened .bash_profile file: vi ~/.bash_profile .

(然后我打开了.bash_profile文件: vi ~/.bash_profile 。)

In this file, I put:

(在这个文件中,我把:)

LD_LIBRARY_PATH=/usr/local/lib
export LD_LIBRARY_PATH

Then if the terminal is closed and restarted, typing echo $LD_LIBRARY_PATH displays no result.

(然后,如果终端关闭并重新启动,则键入echo $LD_LIBRARY_PATH显示任何结果。)

How to set the path permanently?

(如何永久设置路径?)

  ask by singha translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You should add more details about your distribution, for example under Ubuntu the right way to do this is to add a custom .conf file to /etc/ld.so.conf.d , for example

(您应该添加有关您的发行版的更多详细信息,例如在Ubuntu下,正确的方法是将自定义.conf文件添加到/etc/ld.so.conf.d ,例如)

sudo gedit /etc/ld.so.conf.d/randomLibs.conf

inside the file you are supposed to write the complete path to the directory that contains all the libraries that you wish to add to the system, for example

(在文件内部,您应该编写包含您希望添加到系统的所有库的目录的完整路径,例如)

/home/linux/myLocalLibs

remember to add only the path to the dir, not the full path for the file, all the libs inside that path will be automatically indexed.

(记得只添加dir的路径,而不是文件的完整路径,该路径中的所有lib都将自动编入索引。)

Save and run sudo ldconfig to update the system with this libs.

(保存并运行sudo ldconfig以使用此库更新系统。)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...