Tensorflow源码编译

一开始不明白tensorflow源码编译和在anaconda中使用tensorflow的区别,后来看到了知乎这篇文章

如何从源码编译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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值