本文最后更新于 196 天前,其中的信息可能已经有所发展或是发生改变。

1.已测试配套环境的兼容版本

CPU

版本 Python 版本 编译器 构建工具
tensorflow-2.6.0 3.6-3.9 MSVC 2019 Bazel 3.7.2
tensorflow-2.5.0 3.6-3.9 MSVC 2019 Bazel 3.7.2
tensorflow-2.4.0 3.6-3.8 MSVC 2019 Bazel 3.1.0
tensorflow-2.3.0 3.5-3.8 MSVC 2019 Bazel 3.1.0
tensorflow-2.2.0 3.5-3.8 MSVC 2019 Bazel 2.0.0
tensorflow-2.1.0 3.5-3.7 MSVC 2019 Bazel 0.27.1-0.29.1
tensorflow-2.0.0 3.5-3.7 MSVC 2017 Bazel 0.26.1
tensorflow-1.15.0 3.5-3.7 MSVC 2017 Bazel 0.26.1
tensorflow-1.14.0 3.5-3.7 MSVC 2017 Bazel 0.24.1-0.25.2
tensorflow-1.13.0 3.5-3.7 MSVC 2015 update 3 Bazel 0.19.0-0.21.0
tensorflow-1.12.0 3.5-3.6 MSVC 2015 update 3 Bazel 0.15.0
tensorflow-1.11.0 3.5-3.6 MSVC 2015 update 3 Bazel 0.15.0
tensorflow-1.10.0 3.5-3.6 MSVC 2015 update 3 Cmake v3.6.3
tensorflow-1.9.0 3.5-3.6 MSVC 2015 update 3 Cmake v3.6.3
tensorflow-1.8.0 3.5-3.6 MSVC 2015 update 3 Cmake v3.6.3
tensorflow-1.7.0 3.5-3.6 MSVC 2015 update 3 Cmake v3.6.3
tensorflow-1.6.0 3.5-3.6 MSVC 2015 update 3 Cmake v3.6.3
tensorflow-1.5.0 3.5-3.6 MSVC 2015 update 3 Cmake v3.6.3
tensorflow-1.4.0 3.5-3.6 MSVC 2015 update 3 Cmake v3.6.3
tensorflow-1.3.0 3.5-3.6 MSVC 2015 update 3 Cmake v3.6.3
tensorflow-1.2.0 3.5-3.6 MSVC 2015 update 3 Cmake v3.6.3
tensorflow-1.1.0 3.5 MSVC 2015 update 3 Cmake v3.6.3
tensorflow-1.0.0 3.5 MSVC 2015 update 3 Cmake v3.6.3

GPU

版本 Python 版本 编译器 构建工具 cuDNN CUDA
tensorflow_gpu-2.6.0 3.6-3.9 MSVC 2019 Bazel 3.7.2 8.1 11.2
tensorflow_gpu-2.5.0 3.6-3.9 MSVC 2019 Bazel 3.7.2 8.1 11.2
tensorflow_gpu-2.4.0 3.6-3.8 MSVC 2019 Bazel 3.1.0 8.0 11.0
tensorflow_gpu-2.3.0 3.5-3.8 MSVC 2019 Bazel 3.1.0 7.6 10.1
tensorflow_gpu-2.2.0 3.5-3.8 MSVC 2019 Bazel 2.0.0 7.6 10.1
tensorflow_gpu-2.1.0 3.5-3.7 MSVC 2019 Bazel 0.27.1-0.29.1 7.6 10.1
tensorflow_gpu-2.0.0 3.5-3.7 MSVC 2017 Bazel 0.26.1 7.4 10
tensorflow_gpu-1.15.0 3.5-3.7 MSVC 2017 Bazel 0.26.1 7.4 10
tensorflow_gpu-1.14.0 3.5-3.7 MSVC 2017 Bazel 0.24.1-0.25.2 7.4 10
tensorflow_gpu-1.13.0 3.5-3.7 MSVC 2015 update 3 Bazel 0.19.0-0.21.0 7.4 10
tensorflow_gpu-1.12.0 3.5-3.6 MSVC 2015 update 3 Bazel 0.15.0 7.2 9.0
tensorflow_gpu-1.11.0 3.5-3.6 MSVC 2015 update 3 Bazel 0.15.0 7 9
tensorflow_gpu-1.10.0 3.5-3.6 MSVC 2015 update 3 Cmake v3.6.3 7 9
tensorflow_gpu-1.9.0 3.5-3.6 MSVC 2015 update 3 Cmake v3.6.3 7 9
tensorflow_gpu-1.8.0 3.5-3.6 MSVC 2015 update 3 Cmake v3.6.3 7 9
tensorflow_gpu-1.7.0 3.5-3.6 MSVC 2015 update 3 Cmake v3.6.3 7 9
tensorflow_gpu-1.6.0 3.5-3.6 MSVC 2015 update 3 Cmake v3.6.3 7 9
tensorflow_gpu-1.5.0 3.5-3.6 MSVC 2015 update 3 Cmake v3.6.3 7 9
tensorflow_gpu-1.4.0 3.5-3.6 MSVC 2015 update 3 Cmake v3.6.3 6 8
tensorflow_gpu-1.3.0 3.5-3.6 MSVC 2015 update 3 Cmake v3.6.3 6 8
tensorflow_gpu-1.2.0 3.5-3.6 MSVC 2015 update 3 Cmake v3.6.3 5.1 8
tensorflow_gpu-1.1.0 3.5 MSVC 2015 update 3 Cmake v3.6.3 5.1 8
tensorflow_gpu-1.0.0 3.5 MSVC 2015 update 3 Cmake v3.6.3 5.1 8
  • Windows下查看CUDA,cudnn版本
  • Windows 安装 CUDA/cuDNN
  • Tensorflow经测试的构建配置

2.Windows 设置

请参阅上面列出的硬件要求和软件要求,并阅读适用于 Windows 的 CUDA® 安装指南。

确保安装的 NVIDIA 软件包与上面列出的版本一致。特别是,如果没有 cuDNN64_8.dll 文件,TensorFlow 将无法加载。如需使用其他版本,请参阅在 Windows 下从源代码构建指南。

将 CUDA®、CUPTI 和 cuDNN 安装目录添加到 %PATH% 环境变量中。例如,如果 CUDA® 工具包安装到 C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0,并且 cuDNN 安装到 C:\tools\cuda,请更新 %PATH% 以匹配路径:

SET PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0\bin;%PATH%
SET PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0\extras\CUPTI\lib64;%PATH%
SET PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0\include;%PATH%
SET PATH=C:\tools\cuda\bin;%PATH%