我想构建Tensorflow Python文档。我找到了页面https://www.tensorflow.org/community/documentation,它表明我可以运行:
bazel run //tensorflow/tools/docs:generate -- --output_dir=/tmp/master_out
但是,当我这样做时,我得到:
...
Traceback (most recent call last):
File "/home/davidn/.cache/bazel/_bazel_davidn/e831f4a532ae5b41126a377f0d9b9359/execroot/org_tensorflow/bazel-out/k8-opt/bin/tensorflow/tools/docs/generate.runfiles/org_tensorflow/tensorflow/tools/docs/generate.py", line 49, in <module>
sys.exit(doc_generator.build(flags))
File "/home/davidn/.cache/bazel/_bazel_davidn/e831f4a532ae5b41126a377f0d9b9359/execroot/org_tensorflow/bazel-out/k8-opt/bin/tensorflow/tools/docs/generate.runfiles/org_tensorflow/tensorflow/tools/docs/generate_lib.py", line 644, in build
visitor = self.run_extraction()
File "/home/davidn/.cache/bazel/_bazel_davidn/e831f4a532ae5b41126a377f0d9b9359/execroot/org_tensorflow/bazel-out/k8-opt/bin/tensorflow/tools/docs/generate.runfiles/org_tensorflow/tensorflow/tools/docs/generate_lib.py", line 613, in run_extraction
self._do_not_descend_map)
File "/home/davidn/.cache/bazel/_bazel_davidn/e831f4a532ae5b41126a377f0d9b9359/execroot/org_tensorflow/bazel-out/k8-opt/bin/tensorflow/tools/docs/generate.runfiles/org_tensorflow/tensorflow/tools/docs/generate_lib.py", line 303, in extract
traverse.traverse(py_modules[0][1], api_visitor)
File "/home/davidn/.cache/bazel/_bazel_davidn/e831f4a532ae5b41126a377f0d9b9359/execroot/org_tensorflow/bazel-out/k8-opt/bin/tensorflow/tools/docs/generate.runfiles/org_tensorflow/tensorflow/tools/common/traverse.py", line 92, in traverse
_traverse_internal(root, visit, [], '')
File "/home/davidn/.cache/bazel/_bazel_davidn/e831f4a532ae5b41126a377f0d9b9359/execroot/org_tensorflow/bazel-out/k8-opt/bin/tensorflow/tools/docs/generate.runfiles/org_tensorflow/tensorflow/tools/common/traverse.py", line 55, in _traverse_internal
_traverse_internal(child, visit, new_stack, child_path)
File "/home/davidn/.cache/bazel/_bazel_davidn/e831f4a532ae5b41126a377f0d9b9359/execroot/org_tensorflow/bazel-out/k8-opt/bin/tensorflow/tools/docs/generate.runfiles/org_tensorflow/tensorflow/tools/common/traverse.py", line 55, in _traverse_internal
_traverse_internal(child, visit, new_stack, child_path)
File "/home/davidn/.cache/bazel/_bazel_davidn/e831f4a532ae5b41126a377f0d9b9359/execroot/org_tensorflow/bazel-out/k8-opt/bin/tensorflow/tools/docs/generate.runfiles/org_tensorflow/tensorflow/tools/common/traverse.py", line 55, in _traverse_internal
_traverse_internal(child, visit, new_stack, child_path)
[Previous line repeated 2 more times]
File "/home/davidn/.cache/bazel/_bazel_davidn/e831f4a532ae5b41126a377f0d9b9359/execroot/org_tensorflow/bazel-out/k8-opt/bin/tensorflow/tools/docs/generate.runfiles/org_tensorflow/tensorflow/tools/common/traverse.py", line 43, in _traverse_internal
visit(path, root, children)
File "/home/davidn/.cache/bazel/_bazel_davidn/e831f4a532ae5b41126a377f0d9b9359/execroot/org_tensorflow/bazel-out/k8-opt/bin/tensorflow/tools/docs/generate.runfiles/org_tensorflow/tensorflow/tools/common/public_api.py", line 133, in __call__
if self._is_private(full_path, name, child):
File "/home/davidn/.cache/bazel/_bazel_davidn/e831f4a532ae5b41126a377f0d9b9359/execroot/org_tensorflow/bazel-out/k8-opt/bin/tensorflow/tools/docs/generate.runfiles/org_tensorflow/tensorflow/tools/docs/generate_lib.py", line 286, in _is_private
if doc_controls.should_skip(obj):
File "/home/davidn/.cache/bazel/_bazel_davidn/e831f4a532ae5b41126a377f0d9b9359/execroot/org_tensorflow/bazel-out/k8-opt/bin/tensorflow/tools/docs/generate.runfiles/org_tensorflow/tensorflow/tools/docs/doc_controls.py", line 258, in should_skip
return hasattr(obj, _DO_NOT_DOC) or hasattr(obj, _DO_NOT_DOC_INHERITABLE)
File "/home/davidn/.cache/bazel/_bazel_davidn/e831f4a532ae5b41126a377f0d9b9359/execroot/org_tensorflow/bazel-out/k8-opt/bin/tensorflow/tools/docs/generate.runfiles/org_tensorflow/tensorflow/python/platform/flags.py", line 84, in __getattr__
wrapped(_sys.argv)
File "/home/davidn/.cache/bazel/_bazel_davidn/e831f4a532ae5b41126a377f0d9b9359/execroot/org_tensorflow/bazel-out/k8-opt/bin/tensorflow/tools/docs/generate.runfiles/absl_py/absl/flags/_flagvalues.py", line 630, in __call__
name, value, suggestions=suggestions)
absl.flags._exceptions.UnrecognizedFlagError: Unknown command line flag 'output_dir'
我认为这些标志最初已得到正确处理,因为我可以在doc_generator.build()方法的开头转储output_dir的值。
但是,我认为由于某种原因某些东西试图重新解析命令行参数。
我正在使用python 3并从github master分支进行构建。