LD_LIBRARY_PATH影响可执行路径

时间:2022-01-08 22:42:05

I have two versions of python installed on centos 6.4. It came with python 2.6.6. I installed 2.6.2 in /home/python. My PATH variable has 2.6.6 in the path(/usr/bin/python). So in the console when I type 'python' it loads 2.6.6. but, if I change the LD_LIBRARY_PATH to add /home/python/lib and no change to PATH variable, when I type 'python' at the console, it loads 2.6.2. My understanding of executable search order in linux is 'looks at PATH' to find it. So how come the change in LD_LIBRARY_PATH loads 2.6.2? May be understanding is wrong. Could somebody help me understand this behavior?

我在centos 6.4上安装了两个版本的python。它带有python 2.6.6。我在/ home / python中安装了2.6.2。我的PATH变量在路径中有2.6.6(/ usr / bin / python)。所以在我输入'python'的控制台中它加载2.6.6。但是,如果我将LD_LIBRARY_PATH更改为添加/ home / python / lib并且没有更改为PATH变量,那么当我在控制台上键入'python'时,它会加载2.6.2。我对linux中可执行搜索顺序的理解是“查看PATH”来找到它。那么为什么LD_LIBRARY_PATH的变化加载2.6.2呢?可能是理解是错误的。有人可以帮我理解这种行为吗?

1 个解决方案

#1


1  

"python" is a stub executable which loads the Python interpreter from its library. You've told it to look at a different set of libraries first, and so it uses the one it finds there rather than its normal library.

“python”是一个存根可执行文件,它从其库中加载Python解释器。你已经告诉它先查看一组不同的库,所以它使用的是那里找到的库,而不是它的普通库。

#1


1  

"python" is a stub executable which loads the Python interpreter from its library. You've told it to look at a different set of libraries first, and so it uses the one it finds there rather than its normal library.

“python”是一个存根可执行文件,它从其库中加载Python解释器。你已经告诉它先查看一组不同的库,所以它使用的是那里找到的库,而不是它的普通库。