前言

感悟: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. [LeetCode] 18. 四数之和

    题目链接:https://leetcode-cn.com/problems/4sum/ 题目描述: 给定一个包含 n 个整数的数组 nums 和一个目标值 target,判断 nums 中是否存在四个 ...

  2. vue页面固定锁死

  3. Google Chrome即将开始警告—停止支持Flash Player

    Adobe 计划在 2020 年让 Flash Player 彻底退休,整个科技行业都在为这个关键时刻做准备,包括浏览器开发机构,Google 作为最主要的一员,试图尽可能顺利地完成 Flash Pl ...

  4. 数据结构排序算法插入排序Java实现

    public class InsertDemo { public static void main(String args[]) { int[] sort ={4,2,1,3,6,5,9,8,10,7 ...

  5. VS你正在调试 XXXX 的发布版本

    按理来说,生成模式选择Debug就能解决这个问题,但是有些时候,即使生成切换到Debug,也依然还是提示正在调试 发布的版本 ,无奈一个文件一个文件的对比,最后发现是Properties文件夹下面的A ...

  6. react 事件绑定 es5/es6

    // vscode shift + ctrl + v 预览 es 5 写法 无参函数的绑定 first methods 定义函数: handleClick(e) { // e - 事件对象 e.pre ...

  7. Java实训作业

    1.编写程序:声明一个整型变量a,并赋初值5,在程序中判断a是奇数还是偶数,然后输出判断的结果. public class hello{ public static void main(String[ ...

  8. MySQL学习基础知识2

    1.基础语句 查 select(* | 字段名 | 四则运算 | 聚合函数) from 表名称; 加上as取别名 as可省略 如:select name, (math+english)/2 total ...

  9. NOIP 2019游记

    Update on 2019.4.20 禁赛预定

  10. 函数内部还是不要使用 strtok()

    今天在调试程序的时候,遇到一个奇怪的事情,一开始担心是代码存在内存溢出引起的,花了半个小时没找到原因. 在吃饭的时候,突然想起可能是 strtok() 引起的,查找调用的函数,果然发现在函数中使用了  ...