Tensorflow在Windows下使⽤踩坑
TensorFlow 是⼀个端到端开源机器学习平台
安装
pip3  install tensorflow
使⽤时报错如下
2020-06-0309:42:51.737502: W tensorflow/stream_executor/platform/default/:55] Could no
t load dynamic library 'cudart64_101.dll'; dlerror: cudart64_101.dll not found
2020-06-0309:42:51.737502: I tensorflow/stream_executor/cuda/:29] Ignore above cudart
dlerror if you do not have a GPU set up on your machine.
2020-06-0309:42:53.392597: I tensorflow/compiler/xla/:168] XLA service 0x167fbc50tensorflow版本选择
initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2020-06-0309:42:53.392597: I tensorflow/compiler/xla/:176] StreamExecutor devic
e (0): Host, Default Version
2020-06-0309:42:53.395597: I tensorflow/stream_executor/platform/default/:44] Successf
ully opened dynamic library nvcuda.dll
2020-06-0309:42:53.472601: I tensorflow/core/common_runtime/gpu/:1561] Found device 0
with properties:
pciBusID: 0000:01:00.0 name: GeForce GTX 670 computeCapability: 3.0
没有cuDNN64_7.dll⽂件,TensorFlow 将⽆法加载
Windows上搭建TensorFlow的开发环境
需要⾄少需要安装:
  1.python
  2.CUDA和CuDNN
  CUDA 是NVIDIA发明了⼀种并⾏计算平台和编程模型。通过利⽤图形处理单元(GPU)的功能,可以显着提⾼计算性能下载后安装
配置环境变量
SET PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin;%PATH%
SET PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\extras\CUPTI\libx64;%PATH%
SET PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include;%PATH%
查看是否安装成功
nvcc -V
    NVIDIA cuDNN是⽤于深度神经⽹络的GPU加速的原语库
下载后解压
配置环境变量
SET PATH=C:\Program Files\cuda\bin;%PATH%
查看⾃⼰的GPU,配置环境变量
SET PATH=C:\Program Files\NVIDIA Corporation\NVSMI;%PATH%
查看命令
nvidia-smi
  3.TensorFlow(GPU版)
安装前⼀定要确认好每个软件的版本是否相互⽀持
Bazel 是⽤于编译 TensorFlow 的构建⼯具
  将 Bazel 可执⾏⽂件的位置添加到%PATH%环境变量中
先,根据版本对应不同版本的软件
eg:
  tensorflow2.2.0  Python 3.7.7

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。