【问题标题】:How to get tensorflow-gpu v2 working on Windows with NVidia GPU如何让 tensorflow-gpu v2 在带有 NVidia GPU 的 Windows 上运行
【发布时间】:2021-04-07 23:49:43
【问题描述】:

要让tensorflow-gpu 2.x Python 包在带有 NVidia GPU 的 Windows 上运行的步骤是什么?

即我怎样才能摆脱Could not find 'cudart64_101.dll' 然后Could not find 'cudnn64_7.dll'

【问题讨论】:

    标签: python windows tensorflow tensorflow2.0 nvidia


    【解决方案1】:

    步骤

    • 根据你看到的错误信息需要特定版本,不是最新版本!

    1。下载并安装最新的 NVidia 驱动程序

    https://www.nvidia.com/Download/index.aspx

    2。安装 TensorFlow Python 包

    pip uninstall tensorflow
    pip install tensorflow-gpu
    

    (*) 对于较新的版本,tensorflowtensorflow-gpu 是同一个包,所以只需更新 tensorflow 使用:

    pip install --upgrade tensforflow
    

    3。测试

    首先以下测试会失败,请注意丢失文件的版本,例如Could not find 'cudart64_101.dll'

    import tensorflow
    
    tensorflow.test.is_built_with_gpu_support() # Test install of pip package, should output True
    tensorflow.test.is_gpu_available() # Should output True
    tensorflow.test.gpu_device_name() # Should output something like /device:GPU:0
    

    4。下载并安装 CUDA Toolkit 10.1 本地设置

    • 您需要的版本是未找到的版本,例如cudart64_101.dll --> 版本 10.1.
    • 您需要取消选择组件,因为安装程序包含较旧的驱动程序,在网络设置中这不起作用

    https://developer.nvidia.com/cuda-10.1-download-archive-base?target_os=Windows&target_arch=x86_64&target_version=10&target_type=exelocal

    选择自定义设置并:

    • 取消选择CUDA / Visual Studio Integration
    • 取消选择Driver components

    5。确保这些文件夹已添加到路径:

    • 没有其他版本的 CUDA
    C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin;
    C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\libnvvp;
    

    6。再次测试

    • 重新启动 IDE 以接收新的环境变量(包括 PATH)

    会失败,请注意丢失文件的版本,例如Could not find 'cudnn64_7.dll'

    7。为 CUDA 10.1 下载并手动安装 CUDNN 7.6.5

    • 您需要的版本是未找到的版本,例如cudnn64_7.dll --> 版本 7.x 用于 CUDA 10.1(或您需要的 CUDA 版本)

    https://developer.nvidia.com/rdp/cudnn-archive

    • cuda文件夹的内容解压并复制到:C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\(或您下载安装的版本)
    • 如果您有任何冲突,请跳过重复文件

    8。再次测试

    • 假设您下载了正确的版本,这次应该可以工作

    【讨论】:

      猜你喜欢
      • 2020-08-11
      • 2019-10-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-11-27
      • 1970-01-01
      • 2021-08-03
      • 1970-01-01
      相关资源
      最近更新 更多