【问题标题】:I got an error message about python version error when installing appium using 'npm install -g appium@1.8.1'使用“npm install -g appium@1.8.1”安装 appium 时,我收到一条关于 python 版本错误的错误消息
【发布时间】:2019-04-03 20:01:10
【问题描述】:

我尝试使用“npm install -g appium@1.8.1”命令安装 appium。但是出现了这个错误。

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

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

如何正确安装这个特定版本的 appium?我用这个来做katalon。

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

【问题讨论】:

  • 请在您的问题中包含错误文本,而不是链接到屏幕截图。链接资源可能会随着时间的推移而消失,使未来的访问者难以理解您的问题。谢谢!

标签: python npm appium katalon-studio


【解决方案1】:

这是由于 npm 中的 python 版本错误造成的。改成python2就可以解决问题了。

npm config set python python2.7

【讨论】:

    猜你喜欢
    • 2019-12-03
    • 2021-02-15
    • 2014-07-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-12-23
    • 2021-08-25
    • 1970-01-01
    相关资源
    最近更新 更多