简体   繁体   English

使用结构更改LD_LIBRARY_PATH

[英]using fabric to change LD_LIBRARY_PATH

when i login a remote server through ssh, i see the LD_LIBRARY_PATH was : 当我通过ssh登录远程服务器时,我看到LD_LIBRARY_PATH为:

echo $LD_LIBRARY_PATH
:/usr/local/lib

And when i use fabric in python, to run the same code in fabric run api, the result is empty. 当我在python中使用fabric时,要在fabric run api中运行相同的代码,结果为空。

from fabric.api import *
def test():
    run("echo $LD_LIBRARY_PATH")

and even when i try to change the LD_LIBRARY_PATH using fabric, it doesn't work at all. 即使当我尝试使用结构更改LD_LIBRARY_PATH时,它也不起作用。

from fabric.api import *
def test():
    run("echo $LD_LIBRARY_PATH")
    run("export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH")

Does anyone know why? 有人知道为什么吗?

I had the same problem and here is a way to fix it. 我遇到了同样的问题,这是一种解决方法。 You need at least fabric 1.5.4 i think to use shell_env. 您至少需要面料1.5.4,我想使用shell_env。

with shell_env(LD_LIBRARY_PATH ="/usr/local/lib"):
    run('something')

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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