Tensorflow C++ API 示例行结束?

Tensorflow C++ API example line ending?

我有一个问题 运行 标准 C++ API 示例: https://www.tensorflow.org/api_guides/cc/guide

我创建了所有文件和目录。 Bazel 启动后会报错

INFO: From Compiling external/snappy/snappy-sinksource.cc [for host]:
cc1plus: warning: command line option '-Wno-implicit-function-declaration' is valid for C/ObjC but not for C++
ERROR: /home/[...]/tensorflow/tensorflow/core/BUILD:1796:1: Executing genrule //tensorflow/core:version_info_gen failed (Exit 127): bash failed: error executing command 
  (cd /home/[...]/.cache/bazel/_bazel_[...]/[...]/org_tensorflow && \
  exec env - \
    LD_LIBRARY_PATH=/opt/ros/lunar/lib \
    PATH=/opt/ros/lunar/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games \
  /bin/bash -c 'source external/bazel_tools/tools/genrule/genrule-setup.sh; tensorflow/tools/git/gen_git_source.py --generate external/local_config_git/gen/spec.json external/local_config_git/gen/head external/local_config_git/gen/branch_ref "bazel-out/host/genfiles/tensorflow/core/util/version_info.cc"')
/usr/bin/env: 'python\r': No such file or directory
Target //tensorflow/cc/example:example failed to build
INFO: Elapsed time: 2.329s, Critical Path: 0.57s
FAILED: Build did NOT complete successfully
ERROR: Build failed. Not running target

我的系统是 运行 Debian。行尾似乎有问题,但我真的找不到任何东西。默认情况下不应该在 Linux 系统下运行示例吗?

还是我错误地配置了 bazel?

在 tensorflow 目录中的所有文件上 运行ning dos2unix 之后,编译工作。我觉得这真的很奇怪。 tf 不应该 运行 在 Unix 系统中开箱即用吗?无论如何,参考 How can I run dos2unix on an entire directory? 递归到 运行 dos2unix。

我在尝试遵循他们的指南时遇到了同样的错误 Build failed. Not running target。对我来说,问题是通过在编译之前用 bazel 显式编译 Tensorflow 和 运行 example.cc 文件来解决的。 IE。 :

  • ./configure
  • bazel build //tensorflow:libtensorflow_cc.so
  • bazel run -c opt //tensorflow/cc/example:example