我正在尝试通过 npm 安装以下 vue 组件:https://github.com/xwpongithub/vue-range-slider我将其安装为:npm install vue-range-component --save但是,我在控制台中收到以下错误:> fsevents@1.2.11 install /Users/jovan/Desktop/work/projects/topgraphs/node_modules/fsevents> node-gyp rebuildgyp ERR! configure error gyp ERR! stack Error: Command failed: /Users/jovan/anaconda3/bin/python -c import sys; print "%s.%s.%s" % sys.version_info[:3];gyp ERR! stack File "<string>", line 1gyp ERR! stack import sys; print "%s.%s.%s" % sys.version_info[:3];gyp ERR! stack ^gyp ERR! stack SyntaxError: invalid syntaxgyp ERR! stack gyp ERR! stack at ChildProcess.exithandler (child_process.js:294:12)gyp ERR! stack at ChildProcess.emit (events.js:200:13)gyp ERR! stack at maybeClose (internal/child_process.js:1021:16)gyp ERR! stack at Socket.<anonymous> (internal/child_process.js:430:11)gyp ERR! stack at Socket.emit (events.js:200:13)gyp ERR! stack at Pipe.<anonymous> (net.js:586:12)gyp ERR! System Darwin 18.6.0gyp ERR! command "/usr/local/Cellar/node/12.3.1/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"gyp ERR! cwd /Users/jovan/Desktop/work/projects/topgraphs/node_modules/fseventsgyp ERR! node -v v12.3.1gyp ERR! node-gyp -v v3.8.0gyp ERR! not ok npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 (node_modules/fsevents):npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 install: `node-gyp rebuild`npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1+ vue-range-component@1.0.3所以,显然,组件已经安装,但是Python中存在某种语法错误?在互联网上搜索解决方案,我只找到了一些对不同Python版本的引用,但上面的整个错误输出中没有提到一个版本。我正在使用蟒蛇3.7。
2 回答
慕运维8079593
TA贡献1876条经验 获得超5个赞
是的,给出的Python代码只对python3之前的python版本有效。
import sys; print "%s.%s.%s" % sys.version_info[:3];
在python3中,该语句被设置为一个函数,因此括号不能省略。应更新包以使用:print
import sys; print("%s.%s.%s" % sys.version_info[:3]);
..相反。
添加回答
举报
0/150
提交
取消