我在Mac(Mojave)上安装了Anaconda,现在启动外壳时,它将自动激活conda环境。直到我意识到.bashrc中的某些命令在启动时未执行之前,这完全没问题。特别是,我增加了HISTSIZE和HISTFILESIZE,但是它们似乎始终停留在默认值500上。经过一番谷歌搜索后,我了解到由于安装了anaconda,启动时使用的是.bash_profile而不是。 bashrc。这就是我的.bash_profile的外观(如下所示),只是将我的.bashrc文件(例如HISTFILESIZE = 100000)中的命令添加到我的.bash_profile的顶部似乎没有任何作用。关于我在做什么错的任何建议吗?谢谢!
# Setting PATH for Python 3.7
# The original version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.7/bin:${PATH}"
export PATH
# added by Anaconda3 2019.07 installer
# >>> conda init >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$(CONDA_REPORT_ERRORS=false '/anaconda3/bin/conda' shell.bash hook 2> /dev/null)"
if [ $? -eq 0 ]; then
\eval "$__conda_setup"
else
if [ -f "/anaconda3/etc/profile.d/conda.sh" ]; then
# . "/anaconda3/etc/profile.d/conda.sh" # commented out by conda initialize
CONDA_CHANGEPS1=false conda activate base
else
\export PATH="/anaconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda init <<<
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('//anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "//anaconda3/etc/profile.d/conda.sh" ]; then
. "//anaconda3/etc/profile.d/conda.sh"
else
export PATH="//anaconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
答案 0 :(得分:0)
您可以尝试按照建议的Here在bash_profile中添加以下行:
if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi