前言:笔者使用的gpu是gtx1070
一句话概括,cuda以及cudnn的版本不对应
踩坑过程:在官网按照其推荐配置,下载了cuda10.1以及cudnn7.6.0.64,使用anaconda安装python3.6,pip安装tensorflow-gpu1.13.1。结果出现无法找到dll的报错。具体如下:
Traceback (most recent call last):
File"C:\Users\shelton\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\pywrap_tensorflow.py",line 58, in
fromtensorflow.python.pywrap_tensorflow_internal import *
File"C:\Users\shelton\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py",line 28, in
_pywrap_tensorflow_internal =swig_import_helper()
File"C:\Users\shelton\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py",line 24, in swig_import_helper
_mod =imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File"C:\Users\shelton\AppData\Local\Programs\Python\Python37\lib\imp.py",line 242, in load_module
return load_dynamic(name,filename, file)
File "C:\Users\shelton\AppData\Local\Programs\Python\Python37\lib\imp.py",line 342, 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"C:\Users\shelton\Desktop\tensorflow-gpu-test.py", line 1, in
import tensorflow
File "C:\Users\shelton\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\__init__.py",line 24, in
from tensorflow.python importpywrap_tensorflow # pylint: disable=unused-import
File"C:\Users\shelton\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\__init__.py",line 49, in
from tensorflow.python importpywrap_tensorflow
File"C:\Users\shelton\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\pywrap_tensorflow.py",line 74, in
raise ImportError(msg)
ImportError: Traceback (most recent calllast):
File"C:\Users\shelton\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\pywrap_tensorflow.py",line 58, in
from tensorflow.python.pywrap_tensorflow_internalimport *
File"C:\Users\shelton\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py",line 28, in
_pywrap_tensorflow_internal =swig_import_helper()
File"C:\Users\shelton\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py",line 24, in swig_import_helper
_mod =imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "C:\Users\shelton\AppData\Local\Programs\Python\Python37\lib\imp.py",line 242, in load_module
return load_dynamic(name,filename, file)
File"C:\Users\shelton\AppData\Local\Programs\Python\Python37\lib\imp.py",line 342, in load_dynamic
return _load(spec)
ImportError: DLL load failed: 找不到指定的模块。
Failed to load the native TensorFlowruntime.
Seehttps://www.tensorflow.org/install/errors
for some common reasons and solutions. Include the entire stack trace
above this error message when asking forhelp.
解决过程:
1、 重复卸载安装tensorflow-gpu 失败
2、 在不改变cuda版本以及cudnn版本的前提下,安装不同版本的tensorflow-gpu,包括(1.8.0,1.9.0,1.10.0,1.12.0,1.7.0),在版本低于1.10的时候,会出现无法匹配cuda或者无法找到cuda的情况,原因可能是低版本的tensorflow-gpu仅支持cuda9.0以下版本
3、 装回cuda10.0+cudnn7.5.0.56+tensorflow-gpu1.13.1,情况依旧没有改变
4、 装回cuda10.0+cudnn7.4.2.24+ tensorflow-gpu1.13.1,情况完美解决
总结:问题应该还是出在cuda和cudnn的版本匹配问题上。
网友评论