How to set the environmental variable LD_LIBRARY_PATH in linux

后端 未结 10 1462
独厮守ぢ
独厮守ぢ 2020-11-22 11:11

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

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

相关标签:
10条回答
  • 2020-11-22 11:44

    Keep the previous path, don't overwrite it:

    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/your/custom/path/
    

    You can add it to your ~/.bashrc:

    echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/your/custom/path/' >> ~/.bashrc
    
    0 讨论(0)
  • 2020-11-22 11:45

    The file .bash_profile is only executed by login shells. You may need to put it in ~/.bashrc, or simply logout and login again.

    0 讨论(0)
  • 2020-11-22 11:46
    1. Go to the home folder and edit .profile
    2. Place the following line at the end

      export LD_LIBRARY_PATH=<your path>

    3. Save and Exit.

    4. Execute this command

      sudo ldconfig

    0 讨论(0)
  • 2020-11-22 11:47

    For some reason no one has mentioned the fact that the bashrc needs to be re-sourced after editing. You can either log out and log back in (like mentioned above) but you can also use the commands: source ~/.bashrc or . ~/.bashrc.

    0 讨论(0)
提交回复
热议问题