python.exe语法问题NPM

2024-09-28 03:20:43 发布

您现在位置:Python中文网/ 问答频道 /正文

我在运行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     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"

我在Path系统变量中添加了以下内容:

^{pr2}$

在我的用户路径变量中,我对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\

不知道这里发生了什么事,所以感谢任何帮助!在


Tags: nodechildstacklocalsysjsusersappdata
1条回答
网友
1楼 · 发布于 2024-09-28 03:20:43

您尝试运行的命令使用python2语法。它与python3不兼容,因此如果您尝试使用它,您应该会得到一个语法错误。在

或者将脚本升级到python3(大约已经有时间了),或者修复执行路径,以便可以使用过时的Python版本运行它。在

相关问题 更多 >

    热门问题