0

首先,我检查了How to install zeroRPC (python) on windows,但找不到我的问题的答案。

我正在尝试安装 zerorpc 以将 Electronjs 与 python 一起使用,使用:

npm install zerorpc --save

这是错误:

npm ERR! path git
npm ERR! code ENOENT
npm ERR! errno ENOENT
npm ERR! syscall spawn git
npm ERR! enoent Error while executing:
npm ERR! enoent undefined ls-remote -h -t https://github.com/fyears/zerorpc-node.git
npm ERR! enoent
npm ERR! enoent
npm ERR! enoent spawn git ENOENT
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\TXJ0890\AppData\Roaming\npm-cache\_logs\2019-07-24T19_07_27_933Z-debug.log

另外,这是我的 package.json:

{
  "name": "pretty-calculator",
  "main": "main.js",
  "scripts": {
    "start": "electron ."
  },
  "dependencies": {
    "zerorpc": "git+https://github.com/fyears/zerorpc-node.git"
  },
  "devDependencies": {
    "electron": "^5.0.7",
    "electron-rebuild": "^1.8.5"
  }
}

我一直在关注本教程: https ://github.com/fyears/electron-python-example

我的系统:

  • 操作系统:Windows 10。
  • 视觉工作室 2017
  • Python 3.7 和 2.7
  • Node LTS 的最新版本
  • 最新版本的电子

编辑:我已经安装了 windows-build-tools。

npm install -g zerorpc
C:\Users\TXJ0890\OneDrive - Shire PLC\Desktop\python\Electronjs>npm install -g zerorpc

> zeromq@4.6.0 install C:\Users\TXJ0890\AppData\Roaming\npm\node_modules\zerorpc\node_modules\zeromq
> node scripts/prebuild-install.js || (node scripts/preinstall.js && node-gyp rebuild)


prebuild-install WARN install No prebuilt binaries found (target=10.16.0 runtime=node arch=x64 platform=win32)

Downloading libzmq for Windows
Download finished

C:\Users\TXJ0890\AppData\Roaming\npm\node_modules\zerorpc\node_modules\zeromq>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\TXJ0890\AppData\Local\Programs\Python\Python37-32\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:198:13)
gyp ERR! stack     at maybeClose (internal/child_process.js:982:16)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
gyp ERR! System Windows_NT 10.0.16299
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\TXJ0890\AppData\Roaming\npm\node_modules\zerorpc\node_modules\zeromq
gyp ERR! node -v v10.16.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! zeromq@4.6.0 install: `node scripts/prebuild-install.js || (node scripts/preinstall.js && node-gyp rebuild)`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the zeromq@4.6.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\TXJ0890\AppData\Roaming\npm-cache\_logs\2019-07-24T19_43_18_756Z-debug.log
4

1 回答 1

0

这是因为你安装了 python3 而不是 python2(你应该这样做),但是 zeromq 需要 python2。

在您的计算机上安装 Python2 并修改 PATH 变量,使其在 python3 之前找到 python2。之后,您应该能够运行安装命令。记得以后改!

如果这个答案来得太晚,我很抱歉。

于 2019-11-05T10:15:56.927 回答