when without sudo like this:
alex@x-space:~$ ipython
In [1]: import os
In [2]: os.system('echo $LD_LIBRARY_PATH')
......
/root/.mujoco/mjpro150/bin:
python can recognize env vars,but when with sudo to excute python:
alex@x-space:~$ sudo ipython <------- sudo python
In [1]: import os
In [2]: os.system('echo $LD_LIBRARY_PATH')
Out[2]: 0
As you can see $LD_LIBRARY_PATH is empty.
And I have add
export LD_LIBRARY_PATH=/root/.mujoco/mjpro150/bin:$LD_LIBRARY_PATH
to
/root/.bashrc
/root/.profile
/etc/profile
/home/user/.bashrc
/home/user/.profile
All doesn't work.So question is:
How to make python recognize env variables when is executed with sudo?