我正尝试按照本教程在 Debian 操作系统上从源代码构建 TensorFlow cpu only r1.11:https://www.tensorflow.org/install/source
我按照本教程的说明安装了 bazel https://docs.bazel.build/versions/master/install-ubuntu.html 从推荐的二进制安装程序。
然后我按照每一步操作,一切正常,直到这个命令:
bazel test -c opt -- //tensorflow/... -//tensorflow/compiler/... -//tensorflow/contrib/lite/...
它向我显示了这个错误:
ERROR: error loading package '': Encountered error while reading extension file 'closure/defs.bzl': no such package '@io_bazel_rules_closure//closure': The native http_archive rule is deprecated. load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") for a drop-in replacement.
Use --incompatible_remove_native_http_archive=false to temporarily continue using the native rule.
ERROR: error loading package '': Encountered error while reading extension file 'closure/defs.bzl': no such package '@io_bazel_rules_closure//closure': The native http_archive rule is deprecated. load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") for a drop-in replacement.
Use --incompatible_remove_native_http_archive=false to temporarily continue using the native rule.
INFO: Elapsed time: 0.088s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)
FAILED: Build did NOT complete successfully (0 packages loaded)
我在网上看到这可能与bazel有关。因此,我尝试使用 Using Bazel custom APT repository 重新安装 bazel,但我遇到了同样的错误。
最佳答案
从版本 1.12.0 开始,TensorFlow 使用了一些已弃用的 Bazel 功能,这些功能在最新版本的 Bazel 中已被完全删除。不要使用最新版本,暂时尝试使用旧版本。我能够使用 Bazel 0.18.1 在 Windows 上构建 TensorFlow 1.12.0,很可能它也应该适用于 TensorFlow 1.11。
关于tensorflow - 从源代码构建 TensorFlow 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53707068/