运行yarn安装包的时候,遇到以下问题:
npm ERR! gyp verb check python checking for Python executable "python3" in the PATH
npm ERR! gyp verb `which` succeeded python3 /usr/bin/python3
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: Command failed: /usr/bin/python3 -c import sys; print "%s.%s.%s" % sys.version_info[:3];
npm ERR! gyp ERR! stack File "<string>", line 1
npm ERR! gyp ERR! stack import sys; print "%s.%s.%s" % sys.version_info[:3];
npm ERR! gyp ERR! stack ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
npm ERR! gyp ERR! stack SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
解决
如果mac电脑上,没有python2.7,可以在这里下载一个www.python.org/downloads/m…
安装完成之后,运行which python,可以得到:/Library/Frameworks/Python.framework/Versions/2.7/bin/python
如果你用的是npm install来安装包,可以运行一下命令 npm config set python /Library/Frameworks/Python.framework/Versions/2.7/bin/python
如果是yarn的话,运行 yarn config set python /Library/Frameworks/Python.framework/Versions/2.7/bin/python
之后,用npm config list或yarn config list检查对应的python版本是否是2.7即可