9
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

pyenv利用環境下でnpm installでpython2周りのエラーが出た時

Posted at
> node-gyp rebuild

gyp ERR! configure error 
gyp ERR! stack Error: Command failed: 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 
gyp ERR! stack 
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:637:15)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at maybeClose (child_process.js:743:16)
gyp ERR! stack     at Socket.<anonymous> (child_process.js:956:11)
gyp ERR! stack     at Socket.EventEmitter.emit (events.js:95:17)
gyp ERR! stack     at Pipe.close (net.js:465:12)
gyp ERR! System Darwin 16.7.0

python2へのPATHが通っていないのが原因らしい。
pyenvで2系、3系のそれぞれをglobalに設定してやれば解決する。

  • pythonコマンドで python2系を使いたい場合
$ pyenv global 2.7.9 3.4.3
$ python -V
Python 2.7.9
  • pythonコマンドで python3系を使いたい場合
$ pyenv global 3.4.3 2.7.9 
$ python -V
Python 3.4.3
9
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?