1、安装bazel 3.7.2版本
以下是我完整的编译过程,记录下来各位少踩点坑
1、安装bazel=3.7.2 从官网下载https://github.com/bazelbuild/bazel/tags,版本可以选择,直接下载.exe,并把路径配置到环境变量中,可以使用bazel --version查看版本,前期先确保电脑已安装JDK 8和Microsort Visual C++ Redistributable for Visual Studio 2015
2、安装MSYS2,从http://www.msys2.org/下载安装,如果慢可以使用镜像源网站下载,一路默认安装即可,最后会打开命令行输入:pacman -Syuu(更新包),等待完成配置环境变量即可
3、查看自己电脑的硬件cuda版本,从官网下载安装CUDA 11.1和cuDNN 8.2
4、git clone https://github.com/tensorflow/tensorflow
5、进入源码根目录
6、执行python ./configure.py配置自己的电脑情况
7、下面每一步的询问根据自己电脑的情况仔细回答:
(pytorch) D:\pycharm\homework\icc\tensorflow>python ./configure.py
You have bazel 3.7.2 installed.
Please specify the location of python. [Default is C:\Users\miao\Anaconda3\envs\pytorch\python.exe]:
Found possible Python library paths:
C:\Users\miao\Anaconda3\envs\pytorch\lib\site-packages
Please input the desired Python library path to use. Default is [C:\Users\miao\Anaconda3\envs\pytorch\lib\site-packages]
Do you wish to build TensorFlow with ROCm support? [y/N]: n
No ROCm support will be enabled for TensorFlow.
Do you wish to build TensorFlow with CUDA support? [y/N]: y
CUDA support will be enabled for TensorFlow.
Could not find any cuda.h matching version '' in any subdirectory:
''
'include'
'include/cuda'
'include/*-linux-gnu'
'extras/CUPTI/include'
'include/cuda/CUPTI'
'local/cuda/extras/CUPTI/include'
of:
Asking for detailed CUDA configuration...
Please specify the CUDA SDK version you want to use. [Leave em