简体   繁体   English

使用旧版本的python安装xml2json

[英]Install xml2json using older version of python

Very new to Python and Node.js Trying to install xml2json on a windows 10 PC using the following Python和Node.js的新手尝试使用以下方法在Windows 10 PC上安装xml2json

npm install xml2json -g

I get 我懂了

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.

Clear enough error message, so lets do this 清除足够的错误消息,让我们这样做

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

So that reads to me that we are now trying to install python and not xml2json. 因此,这让我明白,我们现在正在尝试安装python而不是xml2json。

I am sure this is just a really NewB mistake, thanks in advance for any help 我确信这只是一个NewB错误,在此先感谢您的帮助

node-gyp accepts the --python flag, not npm. node-gyp gyp接受--python标志,而不是npm。 According to the doc , you should run: 根据文档 ,您应该运行:

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

This command will save the python 2.7 path forever, then you can npm install xml2json -g . 此命令将永久保存python 2.7路径,然后您可以npm install xml2json -g

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM