前言

感悟:cuda 8.0+cudnn 6.0+TensorFlow 1.3 
cuda 9.0+cudnn 7.0+TensorFlow 1.7
python3.6.2+cuda 9.0+cudnn7.5+Tensorflow 1.10.0+Anaconda4.6.11

最近在新的工作站上重新装TensorFlow的GPU版本,刚开始由于省事,直接更新到最新版本1.13,然后输入hello TensorFlow程序。但是却报错“ImportError: DLL load failed: 找不到指定的模块”。无奈之下,各种百度,看到有个比较旧博客提议将TensorFlow版本降低到1.4,于是先卸载再重装,一顿修改之后,又报错“Could not find 'cudart64_80.dll'. TensorFlow requires that this DLL be installed in a directory that is named in your %PATH% environment variable. Download and install CUDA 8.0 from this URL: https://developer.nvidia.com/cuda-toolkit”,这句话的意思就是说我装的TensorFlow版本太低,只能支持CUDA8.0,但是我装的是CUDA9.0,所以出现了不对应。后来,又卸载当前TensorFlow环境,指定安装1.7版本,搞定。特此记录下来,防止后人少踩坑。

以下图示均为命令行操作

TensorFlow版本过低,CUDA版本过高

具体报错如下:

(tensorflow-gpu) C:\Users\WW>python
Python 3.6. |Continuum Analytics, Inc.| (default, Jul , ::) [MSC v. bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow
Traceback (most recent call last):
File "D:\TensorFlow\Anaconda\Anaconda\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\platform\self_check.py", line , in preload_check
ctypes.WinDLL(build_info.cudart_dll_name)
File "D:\TensorFlow\Anaconda\Anaconda\envs\tensorflow-gpu\lib\ctypes\__init__.py", line , in __init__
self._handle = _dlopen(self._name, mode)
OSError: [WinError ] 找不到指定的模块。 During handling of the above exception, another exception occurred: Traceback (most recent call last):
File "<stdin>", line , in <module>
File "D:\TensorFlow\Anaconda\Anaconda\envs\tensorflow-gpu\lib\site-packages\tensorflow\__init__.py", line , in <module>
from tensorflow.python import *
File "D:\TensorFlow\Anaconda\Anaconda\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\__init__.py", line , in <module>
from tensorflow.python import pywrap_tensorflow
File "D:\TensorFlow\Anaconda\Anaconda\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line , in <module>
self_check.preload_check()
File "D:\TensorFlow\Anaconda\Anaconda\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\platform\self_check.py", line , in preload_check
% (build_info.cudart_dll_name, build_info.cuda_version_number))
ImportError: Could not find 'cudart64_80.dll'. TensorFlow requires that this DLL be installed in a directory that is named in your %PATH% environment variable. Download and install CUDA 8.0 from this URL: https://developer.nvidia.com/cuda-toolkit

TensorFlow版本过高,CUDA版本过低

具体错误如下所示:

(tensorflow-gpu) C:\Users\WW>python
Python 3.6. |Continuum Analytics, Inc.| (default, Jul , ::) [MSC v. bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow
Traceback (most recent call last):
File "D:\TensorFlow\Anaconda\Anaconda\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line , in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "D:\TensorFlow\Anaconda\Anaconda\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line , in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "D:\TensorFlow\Anaconda\Anaconda\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line , in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "D:\TensorFlow\Anaconda\Anaconda\envs\tensorflow-gpu\lib\imp.py", line , in load_module
return load_dynamic(name, filename, file)
File "D:\TensorFlow\Anaconda\Anaconda\envs\tensorflow-gpu\lib\imp.py", line , in load_dynamic
return _load(spec)
ImportError: DLL load failed: 找不到指定的模块。 During handling of the above exception, another exception occurred: Traceback (most recent call last):
File "<stdin>", line , in <module>
File "D:\TensorFlow\Anaconda\Anaconda\envs\tensorflow-gpu\lib\site-packages\tensorflow\__init__.py", line , in <module>
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
File "D:\TensorFlow\Anaconda\Anaconda\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\__init__.py", line , in <module>
from tensorflow.python import pywrap_tensorflow
File "D:\TensorFlow\Anaconda\Anaconda\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line , in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "D:\TensorFlow\Anaconda\Anaconda\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line , in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "D:\TensorFlow\Anaconda\Anaconda\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line , in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "D:\TensorFlow\Anaconda\Anaconda\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line , in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "D:\TensorFlow\Anaconda\Anaconda\envs\tensorflow-gpu\lib\imp.py", line , in load_module
return load_dynamic(name, filename, file)
File "D:\TensorFlow\Anaconda\Anaconda\envs\tensorflow-gpu\lib\imp.py", line , in load_dynamic
return _load(spec)
ImportError: DLL load failed: 找不到指定的模块。 Failed to load the native TensorFlow runtime. See https://www.tensorflow.org/install/errors for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.

TensorFlow与CUDA版本的对应关系

附上几张表格:

具体最新版本对应可参考TensorFlow中文网址:https://www.tensorflow.org/install/source#tested_source_configurations

总结

  1. 安装环境时参考的博客一定要注意时间,时间,时间。有可能当时可以的现在就不一定行了,版本问题真的很烦人呐呐呐
  2. 切勿贪图省事,更新到最新版本,要提前了解清楚,然后再装对应的版本

参考

https://blog.csdn.net/yeler082/article/details/80943040

TensorFlow GPU版本号与CUDA的对应产生的错误的更多相关文章

  1. windows安装tensorflow GPU

    一.安装Anaconda Anaconda是Python发行包,包含了很多Python科学计算库.它是比直接安装Python更好的选择. 二.安装Tensorflow 如果安装了tensorflow, ...

  2. Ubuntu 16.04 + CUDA 8.0 + cuDNN v5.1 + TensorFlow(GPU support)安装配置详解

    随着图像识别和深度学习领域的迅猛发展,GPU时代即将来临.由于GPU处理深度学习算法的高效性,使得配置一台搭载有GPU的服务器变得尤为必要. 本文主要介绍在Ubuntu 16.04环境下如何配置Ten ...

  3. Win10 x64 + CUDA 10.0 + cuDNN v7.5 + TensorFlow GPU 1.13 安装指南

    Win10 x64 + CUDA 10.0 + cuDNN v7.5 + TensorFlow GPU 1.13 安装指南 Update : 2019.03.08 0. 环境说明 硬件:Ryzen R ...

  4. tensorflow -gpu安装,史上最新最简单的途径(不用自己装cuda,cdnn)

    tensorflow -gpu安装首先,安装Anoconda1. 官网下载点我: 2.安装 点击 python 3.6 version自动下载x64版,下载好之后,然后安装. 如图,打上勾之后,一路n ...

  5. TensorFlow GPU版本的安装与调试

    笔者采用python3.6.7+TensorFlow1.12.0+CUDA10.0+CUDNN7.3.1构建环境 PC端配置为GTX 1050+Intel i7 7700HQ 4核心8线程@2.8GH ...

  6. tensorflow各个版本的CUDA以及Cudnn版本对应关系

    概述,需要注意以下几个问题: (1)NVIDIA的显卡驱动程序和CUDA完全是两个不同的概念哦!CUDA是NVIDIA推出的用于自家GPU的并行计算框架,也就是说CUDA只能在NVIDIA的GPU上运 ...

  7. 【转】Ubuntu 16.04安装配置TensorFlow GPU版本

    之前摸爬滚打总是各种坑,今天参考这篇文章终于解决了,甚是鸡冻\(≧▽≦)/,电脑不知道怎么的,安装不了16.04,就安装15.10再升级到16.04 requirements: Ubuntu 16.0 ...

  8. 备注: ubt 16.04 安装 gtx 1060 --- 成功运行 tensorflow - gpu

    ---------------------------------------------------------------------------------------------------- ...

  9. win10系统下安装TensorFlow GPU版本

    首先要说,官网上的指南是最好的指南. https://www.tensorflow.org/install/install_windows 需要FQ看. 想要安装gpu版本的TensorFlow.我们 ...

随机推荐

  1. Jquery mobile中用Jquery的append()追加的内容没有Jquery mobile的样式

    Jquery Mobile 动态添加块之后, 样式不是JM内定的样式,解决方案如下: $('#content').append(html).enhanceWithin();//Jquery Mobil ...

  2. CodeBlocks卸载后重装 编译c文件提示错误信息“No such file or directory”

    编译最简单的helloworld程序,提示第一行#include<stdio.h> 找不到头文件. 解决方法: 再次卸载CodeBlocks后,将之前的配置文件删除. 路径:C:\User ...

  3. C#、WPF中如何自定义鼠标样式

    需求:在C#中如何自定义鼠标样式?在这里可以分两种情况,一种是在winForm,另一种是在WPF中(注意使用的Cursor对象不一样) 解决办法如下: a.首先针对WinForm中,我们可以采用图标加 ...

  4. 播放包含flash内容的网页或flash内容, 无法显示相应flash内容

    问题描述 通过Messenger发布的html5网页到player, 如下图所示: 布局播放效果: 解决办法 从Cnario Player菜单栏打开Setting>>Canvas Cont ...

  5. golang类型断言

    一.介绍 类型断言,由于接口是一般类型,不知道具体类型,如果要转成具体类型,就需要使用类型断言 例子: package main import "fmt" func main(){ ...

  6. SQL语句中 INNER JOIN的用法!

    一.SQL语句中  INNER JOIN的用法? 1.INNER JOIN的作用? 可以在两个或者更多的表中获取结果,得出一张新表. [隐式内连接] 表一 car  购物车 表二 user 用户 发现 ...

  7. Capability配置简介

    什么是Capability desired capability的功能是配置Appium会话.他们告诉Appium服务器您想要自动化的平台和应用程序. Desired Capabilities是一组设 ...

  8. jsonp原理,封装,应用(vue项目)

    jsonp原理 JSON是一种轻量级的数据传输格式. JSONP(JSON with Padding)是JSON的一种“使用模式”,可用于解决主流浏览器的跨域数据访问的问题.由于同源策略,一般来说位于 ...

  9. git几个必知托管平台

      程序员必须知道的几个Git代码托管平台 说到Git代码托管平台,首先推荐的是GitHub,好多好的开源项目都来自GitHub,但是GitHub只能新建公开的Git仓库,私有 仓库要收费,如果你做的 ...

  10. Azure DevOps to Azure AppServices

    Azure DevOps is a complete solution for software development, from planning to building to deploymen ...