我在 ubuntu 机器上尝试使用 Tensorflow 时收到此错误。这是新文件夹中的全新 npm 安装。我已经尝试过其他帖子的建议,但仍然无法得到它。我有什么遗漏的吗?
Initialization of backend tensorflow failed Error: Could not locate the bindings file. Tried: → /var/nodejs/tensor/node_modules/@tensorflow/tfjs-node/build/tfjs_binding.node, ... etc
Node :v10.12.0
npm:6.7.0
package.json
{
"name": "tensor",
"scripts": {
"start": "node algo.js"
},
"dependencies": {
"@tensorflow/tfjs-node": "*"
}
}
算法.js
const tf = require('@tensorflow/tfjs-node');
最佳答案
以下步骤之一可能有助于解决您的问题:
- 对依赖项进行全新安装
- 删除
node_modules
文件夹 - 重新运行
npm install
- 删除
- (重新)安装node-gyp:
sudo npm install -g node-gyp
- 通过
sudo
安装依赖项sudo npm install
- 如果此步骤有效,则您的目录结构很可能存在权限问题。您可能想查看this question讨论如何解决该问题。
关于node.js - 后端tensorflow初始化失败错误: Could not locate the bindings file,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56092265/