美文网首页
Linux"优雅"的添加Path, 添加so路径

Linux"优雅"的添加Path, 添加so路径

作者: e196efe3d7df | 来源:发表于2021-11-30 20:27 被阅读0次

    添加全局path

    网上有很多的方法添加path,大部分说的都是在~/.profile后面追加,但这只针对当前用户环境变量,有一种更优雅的方法,添加全局环境变量,就是在/etc/profile.d/文件夹中新建一个*.sh,里面添加export,例如:

    • sudo vim /etc/profile.d/qt_env.sh
    • 添加如下脚本:export PATH="/home/xxx/Qt5.12.10/Tools/QtCreator/bin:$PATH"
    • 然后执行source /etc/profile

    添加so路径

    添加so路径也有一种优雅的方法,就在是/etc/ld.so.conf.d/中新建一个*.conf,并在其中添加so路径,例如:

    • sudo vim /etc/ld.so.conf.d/libQt.conf
    • 添加如下脚本:/home/xxx/Qt5.12.10/5.12.10/gcc_64/lib
    • 然后执行 sudo ldconfig

    相关文章

      网友评论

          本文标题:Linux"优雅"的添加Path, 添加so路径

          本文链接:https://www.haomeiwen.com/subject/goadxrtx.html