在运行npm install时(例如https://github.com/donpark/html2jade),我遇到了这个错误:
/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py:852: Warning: 'as' will become a reserved keyword in Python 2.6
Traceback (most recent call last):
File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp", line 15, in <module>
import gyp
File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 8, in <module>
import gyp.input
File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 852
except ImportError as e:
^
SyntaxError: invalid syntax
python --version生成'Python 2.7.1'
答案 0 :(得分:0)
这不是Python 2.7.1中的语法错误。一个快速的解决方法是将此程序作为python /full/path/to/scriptname.py
运行,它实际上将使用Python 2.7.1。