TensorFlow 是一个端到端开源机器学习平台
安装
pip3 install tensorflow
使用时报错如下
2020-06-03 09:42:51.737502: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could no t load dynamic library 'cudart64_101.dll'; dlerror: cudart64_101.dll not found 2020-06-03 09:42:51.737502: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine. 2020-06-03 09:42:53.392597: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x167fbc50 initialized for platform Host (this does not guarantee that XLA will be used). Devices: 2020-06-03 09:42:53.392597: I tensorflow/compiler/xla/service/service.cc:176] StreamExecutor devic e (0): Host, Default Version 2020-06-03 09:42:53.395597: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successf ully opened dynamic library nvcuda.dll 2020-06-03 09:42:53.472601: I tensorflow/core/common_runtime/gpu/gpu_device.cc: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)的功能,可以显着提高计算性能
CUDA下载地址:IT虾米网
下载后安装
配置环境变量
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加速的原语库
CuDNN下载地址:IT虾米网
下载后解压
配置环境变量
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%
环境变量中
下载地址:https://github.com/bazelbuild/bazel/releases
先 查看tensorflow版本信息,根据版本对应不同版本的软件
eg:
tensorflow2.2.0
Python 3.7.7
原创文章,作者:奋斗,如若转载,请注明出处:https://blog.ytso.com/20474.html