Tensorflow GPU:ImportError:DLL加载失败:找不到指定的模块

Tensorflow GPU:ImportError:DLL加载失败:找不到指定的模块,tensorflow,keras,cudnn,Tensorflow,Keras,Cudnn,尽管我已经安装了CUDA、cuDNN和tensorflow gpu软件包,并且在尝试运行简单的CNN网络时将它们添加到路径中,但我仍然面临以下错误。下面添加了我的软件堆栈的详细信息: TensorFlow: 1.14.0 Keras: 2.3.0 TensorFlow-GPU: 1.14.0 CUDA: 10.1 cuDNN: 7 完整错误堆栈跟踪: Using TensorFlow backend. Traceback (most recent call last): File "D:\

尽管我已经安装了
CUDA
cuDNN
tensorflow gpu
软件包,并且在尝试运行简单的
CNN
网络时将它们添加到
路径中,但我仍然面临以下错误。下面添加了我的软件堆栈的详细信息:

TensorFlow: 1.14.0
Keras: 2.3.0
TensorFlow-GPU: 1.14.0
CUDA: 10.1
cuDNN: 7
完整错误堆栈跟踪:

Using TensorFlow backend.
Traceback (most recent call last):
  File "D:\.virtualenvs\keras-fer-PqSTp19f\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "D:\.virtualenvs\keras-fer-PqSTp19f\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "D:\.virtualenvs\keras-fer-PqSTp19f\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 "D:\.virtualenvs\keras-fer-PqSTp19f\lib\imp.py", line 242, in load_module
    return load_dynamic(name, filename, file)
  File "D:\.virtualenvs\keras-fer-PqSTp19f\lib\imp.py", line 342, in load_dynamic
    return _load(spec)
ImportError: DLL load failed: The specified module could not be found.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Program Files\JetBrains\PyCharm 2018.1.2\helpers\pydev\pydevd.py", line 2066, in <module>
    main()
  File "C:\Program Files\JetBrains\PyCharm 2018.1.2\helpers\pydev\pydevd.py", line 2060, in main
    globals = debugger.run(setup['file'], None, None, is_module)
  File "C:\Program Files\JetBrains\PyCharm 2018.1.2\helpers\pydev\pydevd.py", line 1411, in run
    return self._exec(is_module, entry_point_fn, module_name, file, globals, locals)
  File "C:\Program Files\JetBrains\PyCharm 2018.1.2\helpers\pydev\pydevd.py", line 1418, in _exec
    pydev_imports.execfile(file, globals, locals)  # execute the script
  File "C:\Program Files\JetBrains\PyCharm 2018.1.2\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "D:/PyCharmProjects/keras-fer/fer_ck_1.py", line 3, in <module>
    from keras.models import Sequential
  File "D:\.virtualenvs\keras-fer-PqSTp19f\lib\site-packages\keras\__init__.py", line 3, in <module>
    from . import utils
  File "D:\.virtualenvs\keras-fer-PqSTp19f\lib\site-packages\keras\utils\__init__.py", line 6, in <module>
    from . import conv_utils
  File "D:\.virtualenvs\keras-fer-PqSTp19f\lib\site-packages\keras\utils\conv_utils.py", line 9, in <module>
    from .. import backend as K
  File "D:\.virtualenvs\keras-fer-PqSTp19f\lib\site-packages\keras\backend\__init__.py", line 1, in <module>
    from .load_backend import epsilon
  File "D:\.virtualenvs\keras-fer-PqSTp19f\lib\site-packages\keras\backend\load_backend.py", line 90, in <module>
    from .tensorflow_backend import *
  File "D:\.virtualenvs\keras-fer-PqSTp19f\lib\site-packages\keras\backend\tensorflow_backend.py", line 5, in <module>
    import tensorflow as tf
  File "D:\.virtualenvs\keras-fer-PqSTp19f\lib\site-packages\tensorflow\__init__.py", line 28, in <module>
    from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import
  File "D:\.virtualenvs\keras-fer-PqSTp19f\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "D:\.virtualenvs\keras-fer-PqSTp19f\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in <module>
    raise ImportError(msg)
ImportError: Traceback (most recent call last):
  File "D:\.virtualenvs\keras-fer-PqSTp19f\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "D:\.virtualenvs\keras-fer-PqSTp19f\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "D:\.virtualenvs\keras-fer-PqSTp19f\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 "D:\.virtualenvs\keras-fer-PqSTp19f\lib\imp.py", line 242, in load_module
    return load_dynamic(name, filename, file)
  File "D:\.virtualenvs\keras-fer-PqSTp19f\lib\imp.py", line 342, in load_dynamic
    return _load(spec)
ImportError: DLL load failed: The specified module could not be found.


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后端。
回溯(最近一次呼叫最后一次):
文件“D:\.virtualenvs\keras-fer-PqSTp19f\lib\site packages\tensorflow\python\pywrap\u tensorflow.py”,第58行,在
从tensorflow.python.pywrap\u tensorflow\u内部导入*
文件“D:\.virtualenvs\keras-fer-PqSTp19f\lib\site packages\tensorflow\python\pywrap\u tensorflow\u internal.py”,第28行,在
_pywrap\u tensorflow\u internal=swig\u import\u helper()
文件“D:\.virtualenvs\keras-fer-PqSTp19f\lib\site packages\tensorflow\python\pywrap\u tensorflow\u internal.py”,第24行,在swig\u import\u helper中
_mod=imp.load_模块(“pywrap_tensorflow_internal”,fp,路径名,描述)
文件“D:\.virtualenvs\keras-fer-PqSTp19f\lib\imp.py”,第242行,在加载模块中
返回加载动态(名称、文件名、文件)
文件“D:\.virtualenvs\keras-fer-PqSTp19f\lib\imp.py”,第342行,动态加载
返回负载(规格)
ImportError:DLL加载失败:找不到指定的模块。
在处理上述异常期间,发生了另一个异常:
回溯(最近一次呼叫最后一次):
文件“C:\Program Files\JetBrains\PyCharm 2018.1.2\helpers\pydev\pydevd.py”,第2066行,在
main()
文件“C:\Program Files\JetBrains\PyCharm 2018.1.2\helpers\pydev\pydevd.py”,第2060行,主目录
globals=debugger.run(setup['file'],None,None,is_模块)
文件“C:\Program Files\JetBrains\PyCharm 2018.1.2\helpers\pydev\pydevd.py”,第1411行,正在运行
返回self.\u exec(是模块、入口点、模块名称、文件、全局、局部)
文件“C:\Program Files\JetBrains\PyCharm 2018.1.2\helpers\pydev\pydevd.py”,第1418行,在_exec中
pydev_imports.execfile(文件、全局、局部)#执行脚本
文件“C:\Program Files\JetBrains\PyCharm 2018.1.2\helpers\pydev\\u pydev\u imps\\u pydev\u execfile.py”,第18行,在execfile中
exec(编译(内容+“\n”,文件,'exec'),全局,loc)
文件“D:/PyCharmProjects/keras fer/fer_ck_1.py”,第3行,在
从keras.models导入顺序
文件“D:\.virtualenvs\keras-fer-PqSTp19f\lib\site packages\keras\\uu init\uuuu.py”,第3行,在
从…起导入UTIL
文件“D:\.virtualenvs\keras-fer-PqSTp19f\lib\site packages\keras\utils\\ uuu init\uuu.py”,第6行,在
从…起导入conv_utils
文件“D:\.virtualenvs\keras-fer-PqSTp19f\lib\site packages\keras\utils\conv\u utils.py”,第9行,在
从…起将后端导入为K
文件“D:\.virtualenvs\keras-fer-PqSTp19f\lib\site packages\keras\backend\\uu init\uuuuu.py”,第1行,在
from.load\u后端导入epsilon
文件“D:\.virtualenvs\keras-fer-PqSTp19f\lib\site packages\keras\backend\load\u backend.py”,第90行,在
从.tensorflow\u后端导入*
文件“D:\.virtualenvs\keras-fer-PqSTp19f\lib\site packages\keras\backend\tensorflow\u backend.py”,第5行,在
导入tensorflow作为tf
文件“D:\.virtualenvs\keras-fer-PqSTp19f\lib\site packages\tensorflow\\uuuu init\uuuu.py”,第28行,在
从tensorflow.python导入pywrapu tensorflow 35; pylint:disable=未使用的导入
文件“D:\.virtualenvs\keras-fer-PqSTp19f\lib\site packages\tensorflow\python\\ uu init\uuuuuu.py”,第49行,在
从tensorflow.python导入pywrap\u tensorflow
文件“D:\.virtualenvs\keras-fer-PqSTp19f\lib\site packages\tensorflow\python\pywrap\u tensorflow.py”,第74行,在
提高效率(msg)
ImportError:回溯(最近一次呼叫上次):
文件“D:\.virtualenvs\keras-fer-PqSTp19f\lib\site packages\tensorflow\python\pywrap\u tensorflow.py”,第58行,在
从tensorflow.python.pywrap\u tensorflow\u内部导入*
文件“D:\.virtualenvs\keras-fer-PqSTp19f\lib\site packages\tensorflow\python\pywrap\u tensorflow\u internal.py”,第28行,在
_pywrap\u tensorflow\u internal=swig\u import\u helper()
文件“D:\.virtualenvs\keras-fer-PqSTp19f\lib\site packages\tensorflow\python\pywrap\u tensorflow\u internal.py”,第24行,在swig\u import\u helper中
_mod=imp.load_模块(“pywrap_tensorflow_internal”,fp,路径名,描述)
文件“D:\.virtualenvs\keras-fer-PqSTp19f\lib\imp.py”,第242行,在加载模块中
返回加载动态(名称、文件名、文件)
文件“D:\.virtualenvs\keras-fer-PqSTp19f\lib\imp.py”,第342行,动态加载
返回负载(规格)
ImportError:DLL加载失败:找不到指定的模块。
未能加载本机TensorFlow运行时。
看见https://www.tensorflow.org/install/errors
因为一些常见的原因和解决方案。包括整个堆栈跟踪
以上是请求帮助时的错误消息。

您提到,TF-GPU还不支持Cuda 10.1版。请先完全删除Cuda 10.1版本,然后安装Cuda 10。虽然,我不确定这是否会解决您的问题,但至少不会使您陷入Cuda 10.1版本使用问题。您可以阅读这些要求。
如果您在安装Cuda 10后仍面临此问题,请告知我们。

您提到的,TF-GPU尚不支持的Cuda 10.1版。请先完全删除Cuda 10.1版本,然后安装Cuda 10。虽然,我不确定这是否会解决您的问题,但至少不会使您陷入Cuda 10.1版本使用问题。您可以阅读这些要求。 如果您在安装Cuda 10后仍面临此问题,请告知我们