一开始不明白tensorflow源码编译和在anaconda中使用tensorflow的区别,后来看到了知乎这篇文章
下载tensorflow源码 tensorflow-r1.13
tensorflow源码编译有对应的bazel,下载相对应的bazel
然后启动cmd
1、输入
python configure.py
所有的都选N
2、输入
bazel build tensorflow/tools/graph_transforms:summarize_graph
之后出现一个问题
Visual C++ build tools seems to be installed at D:\software\major\Microsoft\Microsoft Visual Studio\2019\Community\VC
But Bazel can't find the following tools:
VCVARSALL.BAT, cl.exe, link.exe, lib.exe, ml64.exe
然后进行一下设置,
set BAZEL_VC=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC
这个路径下有上面缺失的exe,再次运行命令
bazel build tensorflow/tools/graph_transforms:summarize_graph
运行成功
INFO: From Linking tensorflow/tools/graph_transforms/summarize_graph.exe:
Creating library bazel-out/x64_windows-opt/bin/tensorflow/tools/graph_transforms/summarize_graph.lib and object bazel-out/x64_windows-opt/bin/tensorflow/tools/graph_transforms/summarize_graph.exp
Target //tensorflow/tools/graph_transforms:summarize_graph up-to-date:
C:/users/_bazel_gjmhs4/qhb755k7/execroot/org_tensorflow/bazel-out/x64_windows-opt/bin/tensorflow/tools/graph_transforms/summarize_graph.exe
INFO: Elapsed time: 142.093s, Critical Path: 80.39s, Remote (0.00% of the time): [queue: 0.00%, setup: 0.00%, process: 0.00%]
INFO: 715 processes: 715 local.
INFO: Build completed successfully, 763 total actions
--------------------------------------------------------------------------------------------------------------
原来在执行第一步configure的时候,输入的是./configure
提示'.' 不是内部或外部命令,也不是可运行的程序或批处理文件。
搜索了半天,直到今天才发现,这个是在ubuntu下运行的命令,我的系统是windows
参考tensorflow官方文档:
https://tensorflow.google.cn/install/source
-----------------------------------------------------------------------------------------------------
编译Tensorflow源码所用的bazel版本是0.19.2
选择bazel版本的参考链接如下:
在 Windows 环境中从源代码构建 | TensorFlow
bazel的使用
bazel下载完成后,把它放在一个位置,然后把此路径放在系统环境变量里面,就可以在cmd.exe中进行使用了,教程如下:
参考链接:Mediapipe - Windows10 编译Mediapipe C++版本保姆级教程_HW140701的博客-CSDN博客_mediapipe win10
2022.11.23