使用调试编译 tensorflow 显示有关不存在的 bazel-out 的错误

compiling tensorflow with debug shows an error about non existing bazel-out

我正在尝试为某个 2.x 版本详细构建 pip 包 here

运行之后:

bazel build --config=dbg //tensorflow/tools/pip_package:build_pip_package --verbose_failures

我收到以下消息:

error executing shell command:
/bin/bash -c bazel-out/k8fafe98f9cd48032f8d6a9732902b210aba3b30f85849d3455fe9d9fb327/bin/tensorflow/tools/git/gen_git_source --generate "$@" --git_tag_led (Exit 127): bash failed: error executing command
      (cd /home/john/.cache/bazel/_bazel_john/d320ed9b7367c72a32244d7a65335602/execroot/org_tensorflow && \
      exec env - \
        PATH=/home/john/.cache/bazelisk/downloads/bazelbuild/bazel-3.1.0-linux-x86_64/bin:/usr/local/sbin:/usr/local/bin:/usr/sbigames:/usr/local/games:/snap/bin \
      /bin/bash -c 'bazel-out/k8-opt-exec-50AE0418-ST-e0f78fafe98f9cd48032f8d6a9732902b210aba3b30f85849d3455fe9d9fb327/bin/tensorfe --generate "$@" --git_tag_override=${GIT_TAG_OVERRIDE:-}' '' external/local_config_git/gen/spec.json external/local_config_gconfig_git/gen/branch_ref bazel-out/k8-opt-exec-50AE0418/bin/tensorflow/core/util/version_info.cc)
    Execution platform: @local_execution_config_platform//:platform
    /usr/bin/env: 'python': No such file or directory

确实没有生成 version_info.cc... 巴塞尔版本是 3.1.0

有没有人有什么想法?

可能是因为未安装 python,或者未链接到 /usr/bin/python。后者可以通过 sudo ln -s /usr/bin/python3 /usr/bin/python.

来修复