Reference: https://blog.csdn.net/science_Lee/article/details/79214127
Configure environment variables in ~/.bash_profile by yourself, but the configuration does not take effect after restarting the terminal every time. Need to re-execute: $source ~/.bash_profile
It is found that zsh loads the ~/.zshrc file, and the task environment variable is not defined in the '.zshrc' file.
Solution
At the end of the ~/.zshrc file, add a line:
source ~/.bash_profile
Remember to export the corresponding path in bash_profile
There is another solution
, remember to add PATH with "" (this problem does not exist in bashrc)