M1 MacOS 开发环境配置记录
硬件信息
- Mac mini M1
- 已安装homebrew
install conda with homebrew
brew install anaconda
补上手动配置环境变量
M1的conda安装位置默认为/opt/homebrew/anaconda3
故只需确认好路径正确即可
# 1️⃣进入vim编辑.zshrc配置文件
vim ~/.zshrc
# 2️⃣插入下面conda初始化代码
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/opt/homebrew/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/opt/homebrew/anaconda3/etc/profile.d/conda.sh" ]; then
. "/opt/homebrew/anaconda3/etc/profile.d/conda.sh"
else
export PATH="/opt/homebrew/anaconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
# 3️⃣使生效
source ~/.zshrc
fix conda env show problem
my using theme is
bira
set conda env name by your position that you wanted
# 1. cancel default env name show method
conda config --set changeps1 False
# 2. edit theme file
vim ~/.oh-my-zsh/themes/bira.zsh-theme
# 3. add follow codes in the front of 'ZSH_THEME_RVM_PROMPT_OPTIONS="i v g"'
local conda_prompt='$(conda_prompt_info)'
conda_prompt_info() {
if [ -n "$CONDA_DEFAULT_ENV" ]; then
echo -n "%{$terminfo[bold]$fg[yellow]%}($CONDA_DEFAULT_ENV) %{$reset_color%}"
else
echo -n ''
fi
}
# 4. edit PROMPT value just like this
PROMPT="╭─${user_host}${conda_prompt}${current_dir}${rvm_ruby}${vcs_branch}${venv_prompt}
╰─%B${user_symbol}%b "
# 5. restart iTerm
请相信自己
当我们迷茫,懒惰,退缩的时候 我们会格外的相信命运 相信一切都是命中注定
而当我们努力拼搏,积极向上时 我们会格外的相信自己
所以命运是什么呢? 它是如果你习惯它 那它就会一直左右你
如果你想挣脱它 那它就成为你的阻碍 可如果你打破了它 那它就是你人生的垫脚石!
如果觉得这篇文章对你有小小的帮助的话,记得在右下角点个“推荐”哦,博主在此感谢!