相关:之前写过使用tensorflow-gpu遇到的问题 https://blog.csdn.net/ZhangDanzhu/article/details/83902821
现在换了电脑,同时又接触了keras,遇到一些问题,记录一下
1 cuda安装
报错:
ImportError: Could not find ‘cudart64_100.dll’. TensorFlow requires that this DLL be installed in a directory that is named in your %PATH% environment variable. Download and install CUDA 10.0 from this URL: https://developer.nvidia.com/cuda-90-download-archive
解决方法:
从所给提示中的网站下载提示的cuda版本并安装,我的默认安装于C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0
安装完后相应地配置好环境变量:在系统环境变量path中增加CUDA的bin目录
同时检查一下是否有以下两个环境变量
可以通过在cmd中输入 nvcc -V来检查是否安装配置成功。
2 cuDNN安装
安装完CUDA后,换了个报错
ImportError: Could not find ‘cudnn64_7.dll’. TensorFlow requires that this DLL be installed in a directory that is named in your %PATH% environment variable. Note that installing cuDNN is a separate step from installing CUDA, and this DLL is often found in a different directory from the CUDA DLLs. You may install the necessary DLL by downloading cuDNN 7 from this URL: https://developer.nvidia.com/cudnn
解决办法
去提示的网站上下载对应版本的cuDNN,然后解压,将bin中的cudnn64_7.dll复制到原来CUDA路径中bin目录下。(别的好像不需要,看情况可以一起复制到相对应的路径下)