gpt4 book ai didi

python - 无法使用npm在Windows 10上安装zerorpc

转载 作者:行者123 更新时间:2023-12-03 12:43:21 25 4
gpt4 key购买 nike

首先,我检查了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

我的系统:
  • 操作系统:Windows10。
  • Visual Studio 2017的
  • Python 3.7和2.7
  • Node LTS的最新版本
  • Electron的最新版本

  • 编辑:我已经安装了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

    最佳答案

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

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

    如果这个答案来不及,我很抱歉。

    关于python - 无法使用npm在Windows 10上安装zerorpc,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57189848/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com