2

我正在安装TensorFlow。我遇到了以下问题:我正在从 Source 安装 Tensorflow,并且正在关注 Tensorflow 网站(https://www.tensorflow.org/install/source

我之前安装了Bazel 3.0.0(最新版本),但遇到了类似的错误。在查看其他答案后,我发现此错误与 Bazel 的版本有关。因此我卸载了 Bazel 3.0.0 并安装了 Bazel 0.27.1。但是在终端中输入以下命令(bazel build //tensorflow/tools/pip_package:build_pip_package)时,我收到以下错误:

WARNING: The following rc files are no longer being read, please transfer their contents or import their path into one of the standard rc files:
/home/aviraj/tensorflow/tools/bazel.rc
Starting local Bazel server and connecting to it...
ERROR: /home/aviraj/tensorflow/WORKSPACE:3:1: name 'http_archive' is not defined
ERROR: Error evaluating WORKSPACE file
ERROR: error loading package '': Encountered error while reading extension file 'closure/defs.bzl': no such package '@io_bazel_rules_closure//closure': error loading package 'external': Could not load //external package
ERROR: error loading package '': Encountered error while reading extension file 'closure/defs.bzl': no such package '@io_bazel_rules_closure//closure': error loading package 'external': Could not load //external package
INFO: Elapsed time: 2.023s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)

任何帮助将非常感激。谢谢

4

1 回答 1

7

从版本 0.20.0 开始,http_archive原生规则已被弃用,它必须从以下位置加载:@bazel_tools//tools/build_defs/repo:http.bzl。即您需要在WORKSPACEbzl使用它的文件中添加以下内容(除非您有自定义版本):

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
于 2020-04-12T12:50:15.973 回答