第一步:在用户目录下的.bash_profile
文件中添加环境变量,按照格式export {name}={value}
一行一个环境变量。
vim ~/.bash_profile
source ~/.bash_profile
第二步:如果有使用zsh需要进行这一步,没有则忽略。
echo "source ~/.bash_profile" >> ~/.zshrc
source ~/.zshrc
最后一步重启IDE或者重启电脑
参考文章:https://blog.csdn.net/bigboy_coder/article/details/110184019