问题原有:mac中安装了my zsh [ https://www.cnblogs.com/dadonggg/p/11027454.html ] ,但是造成了在使用vscode的时候,提示”zsh: command not found“

原因是两个不同的终端环境变量不一样。

解决方法:

把 bash shell 中.bash_profile 全部环境变量加入zsh shell里就好

cat .bash_profile
# Setting PATH for Python 3.5
# The orginal version is saved in .bash_profile.pysave
#PATH="/Library/Frameworks/Python.framework/Versions/3.5/bin:${PATH}"
#export PATH
export GOPATH=$HOME/go
GOROOT=/usr/local/go
export GOROOT
#GOROOT bin
export PATH=$PATH:$GOROOT/bin
#GOPATH bin
export PATH=$PATH:$GOPATH/bin
export PATH="/usr/local/opt/openssl/bin:$PATH"

将上述中涉及到的go环境变量加入到zash环境变量中去。

vim .zshrc
#在最下面加入go环境变量即可
#export PATH
export GOPATH=$HOME/go
GOROOT=/usr/local/go
export GOROOT
#GOROOT bin
export PATH=$PATH:$GOROOT/bin
#GOPATH bin
export PATH=$PATH:$GOPATH/bin
export PATH="/usr/local/opt/openssl/bin:$PATH"

3、生效配置

source .zshrc