bash LD_LIBRARY_PATH 不适用于多个路径

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15122394/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 04:41:37  来源:igfitidea点击:

LD_LIBRARY_PATH won't work with more than one path

linuxbashterminalshared-libraries

提问by dead_jake

I am trying to set LD_LIBRARY_PATH in my .bashrc, but it wont work when I add more than one path:

我试图在我的 .bashrc 中设置 LD_LIBRARY_PATH,但是当我添加多个路径时它不起作用:

export LD_LIBRARY_PATH=/path/to/lib1

works fine, and when I type $LD_LIBRARY_PATH on a new terminal, I get

工作正常,当我在新终端上输入 $LD_LIBRARY_PATH 时,我得到

$ $LD_LIBRARY_PATH
bash: /path/to/lib1: is a directory

but when I try

但是当我尝试

export LD_LIBRARY_PATH=/path/to/lib1:/path/to/lib2 
(I also tried export LD_LIBRARY_PATH=/path/to/lib2:$LD_LIBRARY_PATH)

I get

我得到

$ $LD_LIBRARY_PATH
bash: /path/to/lib1:/path/to/lib2: No such file or directory

Any ideas why this may be happening?

任何想法为什么会发生这种情况?

回答by zzk

I guess you would like to check the value of $LD_LIBRARY_PATH.

我猜您想检查 $LD_LIBRARY_PATH 的值。

use

echo $LD_LIBRARY_PATH

Otherwise bash would thought you asked it to execute a command stored in $LD_LIBRARY_PATH.

否则 bash 会认为您要求它执行存储在 $LD_LIBRARY_PATH 中的命令。