How to use a different version of python during NPM install?

> Error: Python executable "/usr/local/bin/python" is v3.6.4, which is not supported by gyp.  
> You can pass the --python switch to point to Python >= v2.5.0 & < 3.0.0.

You can use --python option to npm like so:

    npm install --python=python2.7
   
or set it to be used always:

    npm config set python python2.7
   
Npm will in turn pass this option to node-gyp when needed.


Learn More :