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

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


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.

(note: I'm the one who opened an issue on Github to have this included in the docs, as there were so many questions about it ;-) )


set python to python2.7 before running npm install

Linux:

export PYTHON=python2.7

Windows:

set PYTHON=python2.7


For Windows users something like this should work:

PS C:\angular> npm install --python=C:\Python27\python.exe


matomo