node.js 找不到Python可执行文件“/path/to/executable/python2.7”,可以设置PYTHON env变量
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/34570584/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Can't find Python executable "/path/to/executable/python2.7", you can set the PYTHON env variable
提问by Sudhanshu Tripathi
[email protected] install /home/sudthenerd/polymer-starter-kit-1.2.1/node_modules/bufferutil > node-gyp rebuild gyp ERR! configure error gyp ERR! stack Error: Can't find Python executable "/path/to/executable/python2.7", you can set the PYTHON env variable. gyp ERR! stack at failNoPython (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:401:14) gyp ERR! stack at /usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:330:11 gyp ERR! stack at F (/usr/lib/node_modules/npm/node_modules/which/which.js:78:16) gyp ERR! stack at E (/usr/lib/node_modules/npm/node_modules/which/which.js:82:29) gyp ERR! stack at /usr/lib/node_modules/npm/node_modules/which/which.js:93:16 gyp ERR! stack at FSReqWrap.oncomplete (fs.js:82:15) gyp ERR! System Linux 3.13.0-74-generic gyp ERR! command "/usr/bin/nodejs" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" gyp ERR! cwd /home/sudthenerd/polymer-starter-kit-1.2.1/node_modules/bufferutil gyp ERR! node -v v5.3.0 gyp ERR! node-gyp -v v3.2.1 gyp ERR! not ok npm WARN install:[email protected] [email protected] install:
node-gyp rebuildnpm WARN install:[email protected] Exit status 1 > [email protected] install /home/sudthenerd/polymer-starter-kit-1.2.1/node_modules/utf-8-validate > node-gyp rebuild gyp ERR! configure error gyp ERR! stack Error: Can't find Python executable "/path/to/executable/python2.7", you can set the PYTHON env variable. gyp ERR! stack at failNoPython (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:401:14) gyp ERR! stack at /usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:330:11 gyp ERR! stack at F (/usr/lib/node_modules/npm/node_modules/which/which.js:78:16) gyp ERR! stack at E (/usr/lib/node_modules/npm/node_modules/which/which.js:82:29) gyp ERR! stack at /usr/lib/node_modules/npm/node_modules/which/which.js:93:16 gyp ERR! stack at FSReqWrap.oncomplete (fs.js:82:15) gyp ERR! System Linux 3.13.0-74-generic gyp ERR! command "/usr/bin/nodejs" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" gyp ERR! cwd /home/sudthenerd/polymer-starter-kit-1.2.1/node_modules/utf-8-validate gyp ERR! node -v v5.3.0 gyp ERR! node-gyp -v v3.2.1 gyp ERR! not ok npm WARN install:[email protected] [email protected] install:node-gyp rebuildnpm WARN install:[email protected] Exit status 1
[email protected] 安装 /home/sudthenerd/polymer-starter-kit-1.2.1/node_modules/bufferutil > node-gyp重建gyp ERR!配置错误gyp ERR!堆栈错误:找不到 Python 可执行文件“/path/to/executable/python2.7”,您可以设置 PYTHON env 变量. 吉普错误!堆栈在 failNoPython (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:401:14) gyp ERR!堆栈在 /usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:330:11 gyp ERR!堆栈在 F (/usr/lib/node_modules/npm/node_modules/which/which.js:78:16) gyp ERR!堆栈在 E (/usr/lib/node_modules/npm/node_modules/which/which.js:82:29) gyp ERR!堆栈在 /usr/lib/node_modules/npm/node_modules/which/which.js:93:16 gyp ERR!堆栈在 FSReqWrap.oncomplete (fs.js:82:15) gyp ERR!系统 Linux 3.13.0-74-generic gyp ERR!命令“/usr/bin/nodejs”“/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js”“重建”gyp ERR!cwd /home/sudthenerd/polymer-starter-kit-1.2.1/node_modules/bufferutil gyp ERR!节点 -v v5.3.0 gyp 错误!node-gyp -v v3.2.1 gyp 错误!
node-gyp rebuildnpm WARN install:[email protected] 退出状态 1 > [email protected] install /home/sudthenerd/polymer-starter-kit-1.2.1/node_modules/utf-8-validate > node-gyp重建吉普错误!配置错误gyp ERR!堆栈错误:找不到 Python 可执行文件“/path/to/executable/python2.7”,您可以设置 PYTHON 环境变量。吉普错误!堆栈在 failNoPython (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:401:14) gyp ERR!堆栈在 /usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:330:11 gyp ERR!堆栈在 F (/usr/lib/node_modules/npm/node_modules/which/which.js:78:16) gyp ERR!堆栈在 E (/usr/lib/node_modules/npm/node_modules/which/which.js:82:29) gyp ERR!堆栈在 /usr/lib/node_modules/npm/node_modules/which/which.js:93:16 gyp ERR!堆栈在 FSReqWrap.oncomplete (fs.js:82: 15)吉普错误!系统 Linux 3.13.0-74-generic gyp ERR!命令“/usr/bin/nodejs”“/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js”“重建”gyp ERR!cwd /home/sudthenerd/polymer-starter-kit-1.2.1/node_modules/utf-8-validate gyp ERR!节点 -v v5.3.0 gyp 错误!node-gyp -v v3.2.1 gyp 错误!不行 npm WARN install:[email protected] [email protected] install:node-gyp rebuildnpm WARN install:[email protected] 退出状态 1
回答by Kodie Grantham
Scott Frees' solution didn't work for me but running
Scott Frees 的解决方案对我不起作用,但正在运行
npm config set python $(which python)
npm config set python $(which python)
did.
做过。
回答by Scott Frees
If you installed Python using a package manager, it should already be on your path- but if not: add it like this:
如果你使用包管理器安装了 Python,它应该已经在你的路径上 - 但如果没有:像这样添加它:
export PATH="$PATH:/usr/local/bin/python (or wherever you installed python to)
export PATH="$PATH:/usr/local/bin/python ( 或者你安装 python 的任何地方)
Node-gyp requires 2.x and cannot use Python3 (do you have the right version installed?).
Node-gyp 需要 2.x 并且不能使用 Python3(你安装了正确的版本吗?)。
See Running Python on Windows for Node.js dependenciesfor Windows to make sure you have your environment variable set.
有关Windows 的 Node.js 依赖项,请参阅在 Windows 上运行 Python以确保您已设置环境变量。

