python.exe语法问题-NPM
我在运行Npm安装时遇到问题。我得到以下错误:python.exe语法问题-NPM,python,npm-install,Python,Npm Install,我在运行Npm安装时遇到问题。我得到以下错误: gyp ERR! stack Error: Command failed: C:\Users\userxxx\AppData\Local\Programs\Python\Python37-32\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3]; gyp ERR! stack File "<string>", line 1 gyp ERR! stack
gyp ERR! stack Error: Command failed: C:\Users\userxxx\AppData\Local\Programs\Python\Python37-32\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack File "<string>", line 1
gyp ERR! stack import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack ^
gyp ERR! stack SyntaxError: invalid syntax
gyp ERR! stack
gyp ERR! stack at ChildProcess.exithandler (child_process.js:276:12)
gyp ERR! stack at emitTwo (events.js:126:13)
gyp ERR! stack at ChildProcess.emit (events.js:214:7)
gyp ERR! stack at maybeClose (internal/child_process.js:915:16)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
gyp ERR! System Windows_NT 10.0.17134
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
在我的用户路径变量中,Python有以下内容:
C:\Users\userxxx\AppData\Local\Programs\Python\Python37-32\Scripts\
C:\Users\userxxx\AppData\Local\Programs\Python\Python37-32\
C:\Users\userxxx\AppData\Local\Programs\Python\Python37\Scripts\
C:\Users\userxxx\AppData\Local\Programs\Python\Python37\
不知道这里发生了什么,所以非常感谢您的帮助 您尝试运行的命令使用Python 2语法。它与Python3不兼容,因此如果您尝试使用它,应该会出现语法错误
要么将脚本升级到Python 3(时间差不多了),要么修复执行路径,以便可以使用过时的Python版本运行它。在这种情况下,我们可以尝试两种解决方案
2.x.
npm安装--忽略脚本安装程序包
注意:这将导致npm停止运行package.json中定义的脚本
我在新安装的node js LTS 10.15.3上看到了这个问题。如果有问题的npm包是node sass,那么现在有版本5.0.0可用,它在python3上运行--忽略对我有用的脚本
C:\Users\userxxx\AppData\Local\Programs\Python\Python37-32\Scripts\
C:\Users\userxxx\AppData\Local\Programs\Python\Python37-32\
C:\Users\userxxx\AppData\Local\Programs\Python\Python37\Scripts\
C:\Users\userxxx\AppData\Local\Programs\Python\Python37\