使用旧版本的python安装xml2json

时间:2016-03-16 14:10:00

标签: python node.js

Python和Node.js的新手 尝试使用以下

在Windows 10 PC上安装xml2json
npm install xml2json -g

我得到了

gyp ERR! stack Error: Python executable "C:\Program Files (x86)\Python35-32\python.EXE" is v3.5.1, which is not supported by gyp.
gyp ERR! stack You can pass the --python switch to point to Python >= v2.5.0 & < 3.0.0.

清除足够的错误消息,所以让我们这样做

npm install xml2json -g --python c:\Python\27\python.exe
npm ERR! not a package c:\Python\27\python.exe
npm ERR! addLocal Could not install c:\Python\27\python.exe

因此,我认为我们现在正在尝试安装python而不是xml2json。

我确信这只是一个真正的NewB错误,提前感谢任何帮助

1 个答案:

答案 0 :(得分:1)

node-gyp接受--python标志,而不是npm。 According to the doc,您应该运行:

npm config set python "c:\Python\27\python.exe"

此命令将永远保存python 2.7路径,然后您可以npm install xml2json -g