首页 > 代码库 > npm install 时遇到的 python 问题

npm install 时遇到的 python 问题

gyp ERR! configure error
gyp ERR! stack Error: Python executable "python" is v2.4.3, which is not supported by gyp.gyp ERR! stack You can pass the --python switch to point to Python >= v2.5.0 & < 3.0.0.gyp ERR! stack     at failPythonVersion (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:125:14)gyp ERR! stack     at /usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:114:9


解决,安装多个版本的python

设定一个符合的一个版本

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 ;-) )


npm install 时遇到的 python 问题