'Python not found for node-gyp

I am trying to npm install for a project in my mac but for some reason it says python not found even though python3 command is working fine and I also set alias python to python3 in by ~/.zshrc and ~/.bash-profile and restarted several times but still the same issue.

Screenshot of the issue.

enter image description here

NOTE: See comments for the solution



Sources

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

Source: Stack Overflow

Solution Source