如何解决“无法加载本机TensorFlow运行时”?

时间:2019-01-06 19:13:54

标签: python tensorflow anaconda cudnn

无法加载本机TensorFlow运行时

我已经使用Windows 10.0,Tensorflow-gpu,cuda 9.0,cudnn 7.0从python版本3.7降级到python 3.6.8。 执行以下代码中所示的命令以训练我的数据。 我得到的错误是:“无法加载本机TensorFlow运行时”。

python train.py --logtostderr --train_dir=training/ --pipeline_config_path=training/faster_rcnn_inception_v2_pets.config

我希望“ TensorFlow将初始化训练,并且训练将开始”。

实际结果:

Traceback (most recent call last):
  File "C:\Users\user\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "C:\Users\user\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "C:\Users\user\Anaconda3\envs\tensorflow1\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\user\Anaconda3\envs\tensorflow1\lib\imp.py", line 243, in load_module
    return load_dynamic(name, filename, file)
  File "C:\Users\user\Anaconda3\envs\tensorflow1\lib\imp.py", line 343, in load_dynamic
    return _load(spec)
ImportError: DLL load failed: The specified module could not be found.

在处理上述异常期间,发生了另一个异常:

Traceback (most recent call last):
  File "train.py", line 47, in <module>
    import tensorflow as tf
  File "C:\Users\user\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
    from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import
  File "C:\Users\user\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "C:\Users\user\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in <module>
    raise ImportError(msg)
ImportError: Traceback (most recent call last):
  File "C:\Users\user\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "C:\Users\user\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "C:\Users\user\Anaconda3\envs\tensorflow1\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\user\Anaconda3\envs\tensorflow1\lib\imp.py", line 243, in load_module
    return load_dynamic(name, filename, file)
  File "C:\Users\user\Anaconda3\envs\tensorflow1\lib\imp.py", line 343, in load_dynamic
    return _load(spec)
ImportError: DLL load failed: The specified module could not be found.


Failed to load the native TensorFlow runtime.

3 个答案:

答案 0 :(得分:0)

您需要更新cuDNN(> = 7.2)。

答案 1 :(得分:0)

尝试将tensorflow版本与CUDA相匹配。

答案 2 :(得分:0)

尝试更新tensorflow

尝试一下:= pip3 install --upgrade tensorflow

为我工作!