'Mac brew doctor show Warning: Homebrew's sbin was not found in your PATH but you have installed formulae that put executables in /usr/local/sbin

I try to upgrade python2.7 to python3 on macOS Catalina, when I run brew doctor, it shows:

Warning: Homebrew's sbin was not found in your PATH but you have installed
formulae that put executables in /usr/local/sbin.
Consider setting the PATH for example like so:
  echo 'export PATH="/usr/local/sbin:$PATH"' >> ~/.zshrc

So I try the command echo 'export PATH="/usr/local/sbin:$PATH"' >> ~/.zshrc which did not works.



Solution 1:[1]

Apple macOS has moved from Bash shell to Zsh (Z Shell).

Solution:
Run the command below in your terminal:

echo 'export PATH="/usr/local/sbin:$PATH"' >> ~/.zshrc

Now quit the terminal by pressing command+q, re-open the terminal and run brew doctor

Solution 2:[2]

You need to close and re-open your terminar after applying:

echo 'export PATH="/usr/local/sbin:$PATH"' >> ~/.zshrc

Solution 3:[3]

After some search I found the commands that works for me:

export PATH="/usr/local/bin:$PATH"
source ~/.bash_profile

Solution 4:[4]

If you write brew doctor in the IDE terminal, then do it in the system terminal, it should work

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Andrei Andrade
Solution 3 marchuang
Solution 4 do8rolyuboff