[报错] [TensorFlow] ImportError: DLL load failed: 找不到指定的模块。

2020年1月10日更新

有关 TensorFlow 与 Cuda 等版本对应关系的链接:https://www.tensorflow.org/install/source#linux

是的,我最近开始疯狂写报错来水文章了。

报错信息

Traceback (most recent call last):
  File "D:\Anaconda3\envs\newest\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "D:\Anaconda3\envs\newest\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "D:\Anaconda3\envs\newest\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:\Anaconda3\envs\newest\lib\imp.py", line 243, in load_module
    return load_dynamic(name, filename, file)
  File "D:\Anaconda3\envs\newest\lib\imp.py", line 343, 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 "D:/Machine Learing/deep-hawkes-graphwave/deep_learning/run_sparse.py", line 5, in <module>
    import tensorflow as tf
  File "D:\Anaconda3\envs\newest\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
    from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import
  File "D:\Anaconda3\envs\newest\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "D:\Anaconda3\envs\newest\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in <module>
    raise ImportError(msg)
ImportError: Traceback (most recent call last):
  File "D:\Anaconda3\envs\newest\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "D:\Anaconda3\envs\newest\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "D:\Anaconda3\envs\newest\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:\Anaconda3\envs\newest\lib\imp.py", line 243, in load_module
    return load_dynamic(name, filename, file)
  File "D:\Anaconda3\envs\newest\lib\imp.py", line 343, 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.

环境

  • Windows 10
  • TensorFlow 2.0.0-Alpha-0
  • Python 3.6

原因分析

因为那个,TensorFlowPythonCudacudnn 以及显卡驱动的版本问题错综复杂,如果排列组合没搞对,可能就会出现上述问题。所以呢,找对一个正确的版本组合是非常重要滴。

解决方案

下面只陈述 Windows 10 环境下的一种组合,嫌麻烦的同学照着配一套就可以了:

  • Python 3.6.8
  • Cuda Toolkit 10.0.130
  • cudnn 7.6.0
  • tensorflow-gpu 2.0.0a0

NVIDIA 显卡驱动的版本为 430.86

我有想写一个快速配环境的教程,写好后贴过来。各位再见。

[教程] 最快速、最简单搭建深度学习环境:Ubuntu+显卡驱动+Cuda+Cudnn+TensorFlow

总算是写了一个,不过配环境这种事情,变量太多,时效性很短,仅供诸君参考,而非万能灵药。地址:
https://blog.csdn.net/xovee/article/details/101203830

Reference

Win10: ImportError: DLL load failed: The specified module could not be found. (June 4, 2019). Retrieved from https://github.com/tensorflow/tensorflow/issues/22794

发布了40 篇原创文章 · 获赞 84 · 访问量 5万+

猜你喜欢

转载自blog.csdn.net/xovee/article/details/90794103