当前位置:   article > 正文

DLL load failed: 找不到指定模块\Failed to load the native TensorFlow runtime解决方法_importerror: dll load failed: 找不到指定的模块。 failed to

importerror: dll load failed: 找不到指定的模块。 failed to load the native t

完整报错信息如下:

  1. Traceback (most recent call last):
  2. File "C:\Users\toy\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in swig_import_helper
  3. return importlib.import_module(mname)
  4. File "C:\Users\toy\AppData\Local\Programs\Python\Python35\lib\importlib\__init__.py", line 126, in import_module
  5. return _bootstrap._gcd_import(name[level:], package, level)
  6. File "<frozen importlib._bootstrap>", line 986, in _gcd_import
  7. File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  8. File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
  9. File "<frozen importlib._bootstrap>", line 666, in _load_unlocked
  10. File "<frozen importlib._bootstrap>", line 577, in module_from_spec
  11. File "<frozen importlib._bootstrap_external>", line 906, in create_module
  12. File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  13. ImportError: DLL load failed: 找不到指定的模块。
  14. During handling of the above exception, another exception occurred:
  15. Traceback (most recent call last):
  16. File "C:\Users\toy\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 41, in <module>
  17. from tensorflow.python.pywrap_tensorflow_internal import *
  18. File "C:\Users\toy\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 21, in <module>
  19. _pywrap_tensorflow_internal = swig_import_helper()
  20. File "C:\Users\toy\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 20, in swig_import_helper
  21. return importlib.import_module('_pywrap_tensorflow_internal')
  22. File "C:\Users\toy\AppData\Local\Programs\Python\Python35\lib\importlib\__init__.py", line 126, in import_module
  23. return _bootstrap._gcd_import(name[level:], package, level)
  24. ImportError: No module named '_pywrap_tensorflow_internal'
  25. During handling of the above exception, another exception occurred:
  26. Traceback (most recent call last):
  27. File "<stdin>", line 1, in <module>
  28. File "C:\Users\toy\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
  29. from tensorflow.python import *
  30. File "C:\Users\toy\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\__init__.py", line 51, in <module>
  31. from tensorflow.python import pywrap_tensorflow
  32. File "C:\Users\toy\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 52, in <module>
  33. raise ImportError(msg)
  34. ImportError: Traceback (most recent call last):
  35. File "C:\Users\toy\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in swig_import_helper
  36. return importlib.import_module(mname)
  37. File "C:\Users\toy\AppData\Local\Programs\Python\Python35\lib\importlib\__init__.py", line 126, in import_module
  38. return _bootstrap._gcd_import(name[level:], package, level)
  39. File "<frozen importlib._bootstrap>", line 986, in _gcd_import
  40. File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  41. File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
  42. File "<frozen importlib._bootstrap>", line 666, in _load_unlocked
  43. File "<frozen importlib._bootstrap>", line 577, in module_from_spec
  44. File "<frozen importlib._bootstrap_external>", line 906, in create_module
  45. File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  46. ImportError: DLL load failed: 找不到指定的模块。
  47. During handling of the above exception, another exception occurred:
  48. Traceback (most recent call last):
  49. File "C:\Users\toy\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 41, in <module>
  50. from tensorflow.python.pywrap_tensorflow_internal import *
  51. File "C:\Users\toy\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 21, in <module>
  52. _pywrap_tensorflow_internal = swig_import_helper()
  53. File "C:\Users\toy\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 20, in swig_import_helper
  54. return importlib.import_module('_pywrap_tensorflow_internal')
  55. File "C:\Users\toy\AppData\Local\Programs\Python\Python35\lib\importlib\__init__.py", line 126, in import_module
  56. return _bootstrap._gcd_import(name[level:], package, level)
  57. ImportError: No module named '_pywrap_tensorflow_internal'
  58. Failed to load the native TensorFlow runtime.
  59. See https://www.tensorflow.org/install/install_sources#common_installation_problems
  60. for some common reasons and solutions. Include the entire stack trace
  61. above this error message when asking for help.

错误原因如下:

1.版本问题

我自己的电脑上是,cuddn更换成6.0,之前TensorFlow1.3+python3.6+cuda8.0+cudnn5.0也是这个错误,换成cudnn6.0就成功了,亲测可用可以试试。以下是其他版本。

tensorflow-gpu v1.9.0 | cuda9.0 |  cuDNN7.1.4可行  | 备注:7.0.4/ 7.0.5/ 7.1.2不明确

tensorflow-gpu v1.8.0 | cuda9.0 |  cuDNN  不明确 | 备注:7.0.4/ 7.0.5/ 7.1.2/ 7.1.4

tensorflow-gpu v1.7.0 | cuda9.0 |  cuDNN  不明确 | 备注:7.0.4/ 7.0.5/ 7.1.2/ 7.1.4

tensorflow-gpu v1.6.0 | cuda9.0 |  cuDNN  不明确 | 备注:7.0.4/ 7.0.5/ 7.1.2/ 7.1.4

tensorflow-gpu v1.5.0 | cuda9.0 |  cuDNN  不明确 | 备注:7.0.4/ 7.0.5/ 7.1.2/ 7.1.4

tensorflow-gpu v1.4.0 | cuda8.0 |  cuDNN 6.0 | 备注:6.0正常使用, 7.0.5不能用,5.1未知 

tensorflow-gpu v1.3.0 | cuda8.0 |  cuDNN 6.0 | 备注:6.0正常使用, 7.0.5不能用,5.1未知 

tensorflow-gpu v1.2.0 | cuda8.0 |  cuDNN 5.1 | 备注:5.1正常使用, 6.0/ 7.0.5 未知

tensorflow-gpu v1.1.0 | cuda8.0 |  cuDNN 5.1 | 备注:5.1正常使用, 6.0/ 7.0.5 未知
 

如果是版本不兼容,假如你之前安装的是cudnn5.1的话,若你的TensorFlow为1.3版本以上,则只要将cudnn64_5改成cudnn64_6就可以了

2. 环境问题

  • python的版本太高了,换成3.6的就好。
  • 安装Visual C++ Redistributable for Visual Studio 2015 vc_redist.x64就可以解决。
  • 确定你的系统中有MSVCP140.DLL,如果没有,可以在这里下载 
  • 确认你的系统PATH环境变量设置正确,把CUDA目录下的bin,lib/x64等路径包含进去 
  • 确认你的电脑正确安装了DXSDK_Jun10 

最后记得安装之前一定要把tensorflow卸载干净:

  1. pip uninstall tensorflow
  2. pip uninstall tensorflow-gpu
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/繁依Fanyi0/article/detail/500426
推荐阅读
相关标签
  

闽ICP备14008679号