【问题标题】:Editing .bash_profiles with conda installed在安装了 conda 的情况下编辑 .bash_profiles
【发布时间】:2020-08-19 03:19:25
【问题描述】:

我正在尝试跟随一本在某些章节中需要一行的书

export PATH="$PATH:$HOME/scripts"

被添加到主目录中的.bash_profiles。可能,在本书的后期达到顶峰之后,它是从终端快速启动位于该文件夹中的脚本而无需指定该文件的路径,这似乎很有用,所以我想这样做。

虽然,由于我之前在我的 mac 上安装了 conda,它显然改变了一些东西,并且添加该行并没有改变 echo $PATH 的输出

.bash_profiles 现在看起来像这样:

# added by Anaconda3 2019.10 installer
# >>> conda init >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$(CONDA_REPORT_ERRORS=false '/Users/eshauchuk/opt/anaconda3/bin/conda' shell.bash hook 2> /dev/null)"
if [ $? -eq 0 ]; then
    \eval "$__conda_setup"
else
    if [ -f "/Users/eshauchuk/opt/anaconda3/etc/profile.d/conda.sh" ]; then
        . "/Users/eshauchuk/opt/anaconda3/etc/profile.d/conda.sh"
        CONDA_CHANGEPS1=false conda activate base
        \export PATH="$PATH:$HOME/scripts"
    else
        \export PATH="/Users/eshauchuk/opt/anaconda3/bin:$PATH"
    fi
fi
unset __conda_setup
export PATH="$PATH:$HOME/scripts" 
# <<< conda init <<<

我现在已将提到的行添加到.bash_profile 的近端,并且还转到此文件中的 conda 文件尝试将其添加到那里,暂时没有更改。

我该怎么做才能让它发挥作用

【问题讨论】:

    标签: bash macos conda


    【解决方案1】:

    查看此评论:

    # !! Contents within this block are managed by 'conda init' !!
    

    所以试着像这样把你的行放在块之后:

    # <<< conda init <<<
    export PATH="$PATH:$HOME/scripts"
    
    

    【讨论】:

    • 谢谢,我已经移动了线路,但是在终端之后echo $PATH 仍然没有显示 bash 集的变化
    • 也许试试 .bashrc insted
    • 我的主目录中没有这样的文件,在使用 ` ls -l ./*/* | 查找它之后grep ".bash" ` 仍然没有结果。感谢您的帮助,我觉得我可以稍后在没有安装 conda 的机器上尝试解决这个问题。
    猜你喜欢
    • 2021-12-22
    • 1970-01-01
    • 2019-11-04
    • 2016-06-12
    • 2021-07-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多