编译tensorflow错误:Encountered error while reading extension file 'closure/defs.bzl': no such package '

编译tenwsorflow的时候出现问题:

[@localhost tensorflow]$ bazel test -c opt – //tensorflow/… -//tensorflow/compiler/… -//tensorflow/contrib/lite/…
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/xiaojin/workzone/coding/github_com/tensorflow/tools/bazel.rc
INFO: Invocation ID: 5872159f-3244-49b2-93bb-ac1e44a00e96
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.029s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)
FAILED: Build did NOT complete successfully (0 packages loaded)

找到的解决办法:https://github.com/tensorflow/tensorflow/issues/24385
问题在于bazel版本太新,tensorflow团队用0.19.1(或更老)的版本编译的tensorflow,新版的bazel将有些功能弃用了,所以编译出错。将bazel降级到老版本就好了。

CentOS下降级bazel

之前用官方方式用yum安装了bazel,发现不能用yum downgrade 直接降级,索性卸载了。后发现github上有发布的历史版本:https://github.com/bazelbuild/bazel/releases
下载了bazel的0.18.1版本的:点击直接下载https://github.com/bazelbuild/bazel/releases/download/0.18.1/bazel-0.18.1-linux-x86_64
这是可运行程序,无需安装。

sudo chmod +x bazel-0.18.1-linux-x86_64
sudo cp bazel-0.18.1-linux-x86_64 /usr/local/bin/bazel

现在可以直接在命令行运行bazel了(如果显示找不到bazel,重开一个终端试试~)

  • 2
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值