Bazel Tensorflow 从源安装:无法识别的选项:--host_force_python=py2

Bazel Tensorflow installation from source: Unrecognized option: --host_force_python=py2

我正在尝试从源代码安装 tensorflow。当 运行 配置文件时,我选择了所有默认参数,然后当尝试 运行:

bazel build -c opt --config=cuda //tensorflow/tools/pip_package:build_pip_package

我收到消息:

INFO: Reading options for 'build' from /home/ubuntu/tensorflow/tensorflow/tools/bazel.rc:
  'build' options: --force_python=py2 --host_force_python=py2 --python2_path=/usr/bin/python --define=use_fast_cpp_protos=true --define=allow_oversize_protos=true --define PYTHON_BIN_PATH=/usr/bin/python --spawn_strategy=standalone --genrule_strategy=standalone
Unrecognized option: --host_force_python=py2

然后当我尝试 运行 build_pip_package 命令时,它找不到 build_pip_package 命令:

build_pip_package: command not found

尽管 bazel-bin/tensorflow/tools/pip_package

中确实存在 build_pip_package 文件

听起来您使用的 Bazel 不知道 --host_force_python 标志。旗帜是 added in January, is it possible you're using an old version of Bazel? You can check with bazel version, make sure you're using at least 0.1.4 (optimally you'd be using 0.3.0).

或者,您可以打开 /home/ubuntu/tensorflow/tensorflow/tools/bazel.rc 并删除行 build --host_force_python=py2,但我不知道该行有多大必要(这样可能会导致其他问题)。