如何在文件 .bashrc 中向 PATH 添加目录?

编程入门 行业动态 更新时间:2024-10-26 21:25:37
本文介绍了如何在文件 .bashrc 中向 PATH 添加目录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

安装 python(EPDFee) 后,我想将/bin 目录添加到 $PATH 变量中.我正在使用 bash shell.我发现我必须在文件 .bashrc

After installing python(EPDFee), I want to add the /bin directory to $PATH variable. I am use bash shell. I have found that I have to add the following line in the file .bashrc

export PATH=/home/usrname/epd/bin:$PATH

我找到了 .bashrc 文件,内容为

I have found the file .bashrc, it reads

PATH=$PATH:/opt/bin

# 由 Canopy 安装程序于 2014-03-29 添加

# VIRTUAL_ENV_DISABLE_PROMPT 可以设置为 '' 使 bashprompt 显示 Canopy 处于活动状态,否则为 1

VIRTUAL_ENV_DISABLE_PROMPT=1 source/home/an/Enthought/Canopy_64bit/User/bin/activate

你能告诉我在哪里可以将 export PATH=/home/usrname/epd/bin:$PATH 添加到或应该添加到另一个文件中吗?

Could you please tell me where can I add export PATH=/home/usrname/epd/bin:$PATH to or is should be added in another file?

推荐答案

你可以这样做:定义一个 EPD_HOME 变量并将其附加到 PATH

You can do it like this : Define a EPD_HOME var and append it to PATH

EPD_HOME=/home/usrname/epd/bin PATH=$PATH:$EPD_HOME:$HOME/bin export PATH

请注意,$EPD_HOME 变量位于 PATH 变量中,一旦您在计算机上打开与用户的连接,就会加载该变量.

Notice that the $EPD_HOME variable is in the PATH variable and is now loaded once you open a connection to your user on the machine.

更多推荐

如何在文件 .bashrc 中向 PATH 添加目录?

本文发布于:2023-05-31 10:08:29,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/389597.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:中向   文件   目录   如何在   bashrc

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!