使用'npm install -g appium@1.8.1'安装appium时出现关于python版本错误的错误消息

时间:2019-02-21 04:12:01

标签: python npm appium katalon-studio

我尝试使用'npm install -g appium@1.8.1'命令安装appium。但是会出现此错误。

https://www.screencast.com/t/iAJUYj59n4

注意:我已经安装了python 3.7。

如何正确安装此特定版本的appium?我正在用这个做喀隆。

C:\Users\heri.susilo>npm install -g appium@1.8.1
npm WARN deprecated appium-android-bootstrap@2.11.0: Moved to appium-android-driver
npm WARN deprecated appium-android-ime@2.0.0: Moved to io.appium.settings
npm WARN deprecated appium-uiautomator@1.2.0: Moved to appium-android-bootstrap
npm WARN deprecated appium-unlock@2.0.0: Moved to io.appium.settings
npm WARN deprecated cross-spawn-async@2.2.5: cross-spawn no longer requires a build toolchain, use it instead
C:\Users\heri.susilo\AppData\Roaming\npm\appium -> C:\Users\heri.susilo\AppData\Roaming\npm\node_modules\appium\build\lib\main.js

> heapdump@0.3.9 install C:\Users\heri.susilo\AppData\Roaming\npm\node_modules\appium\node_modules\heapdump
> node-gyp rebuild


C:\Users\heri.susilo\AppData\Roaming\npm\node_modules\appium\node_modules\heapdump>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
gyp ERR! configure error
gyp ERR! stack Error: Command failed: C:\Users\heri.susilo\AppData\Local\Programs\Python\Python37\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:294:12)
gyp ERR! stack     at ChildProcess.emit (events.js:189:13)
gyp ERR! stack     at maybeClose (internal/child_process.js:970:16)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:259: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"
gyp ERR! cwd C:\Users\heri.susilo\AppData\Roaming\npm\node_modules\appium\node_modules\heapdump
gyp ERR! node -v v10.15.1
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.7 (node_modules\appium\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.7: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: heapdump@0.3.9 (node_modules\appium\node_modules\heapdump):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: heapdump@0.3.9 install: `node-gyp rebuild`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

+ appium@1.8.1
updated 1 package in 53.815s

1 个答案:

答案 0 :(得分:0)

这是由于npm中的python版本错误引起的。将其更改为python2即可解决问题。

npm config set python python2.7