ERR! stack Error: Command failed: python2 -c import platform;

ERR! stack Error: Command failed: python2 -c import platform;

我缺乏 Ruby Rails 和 Python 工具的知识,因此授予高级开发人员对 "update" 我的 mac 设置的权限,以便允许通过 github 访问和协作一个名为 "pawztech-api" 的项目。

现在每次我尝试安装 npm 包(在本例中为 nodemon)时,我都会收到以下错误...

unknown-3c-15-c2-d5-97-aa:express dejimeji$ sudo npm install -g nodemon
Password:

> fsevents@0.3.8 install /usr/local/lib/node_modules/nodemon/node_modules/chokidar/node_modules/fsevents
> node-gyp rebuild

gyp ERR! configure error 
gyp ERR! stack Error: Command failed: python2 -c import platform; print(platform.python_version());
gyp ERR! stack pyenv: python2: command not found
gyp ERR! stack 
gyp ERR! stack The `python2' command exists in these Python versions:
gyp ERR! stack   2.7.9
gyp ERR! stack   pawztech-api
gyp ERR! stack 
gyp ERR! stack 
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:751:12)
gyp ERR! stack     at ChildProcess.emit (events.js:110:17)
gyp ERR! stack     at maybeClose (child_process.js:1015:16)
gyp ERR! stack     at Socket.<anonymous> (child_process.js:1183:11)
gyp ERR! stack     at Socket.emit (events.js:107:17)
gyp ERR! stack     at Pipe.close (net.js:485:12)
gyp ERR! System Darwin 13.4.0
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/nodemon/node_modules/chokidar/node_modules/fsevents
gyp ERR! node -v v0.12.7
gyp ERR! node-gyp -v v2.0.2
gyp ERR! not ok 
npm WARN optional dep failed, continuing fsevents@0.3.8
/usr/local/bin/nodemon -> /usr/local/lib/node_modules/nodemon/bin/nodemon.js
nodemon@1.7.0 /usr/local/lib/node_modules/nodemon

我想我 Python 的版本不对吧?

无论如何,我怎样才能还原或恢复正常设置,以便 npm 安装包时不会出错?

尝试使用

设置本地 pyenv 版本
pyenv local 2.7.9