无法加载本机TensorFlow运行时ImportError:DLL加载失败

时间:2018-04-06 10:57:32

标签: tensorflow

我刚刚通过pip安装了tensorflow gpu v1.7。我还在Windows 10上安装了CUDA v9.0和CUDNN v7。

我的显卡是NVidia GTX 1060 6 GB,驱动程序版本:22.21.13.8554 在尝试在Python 3.6.4上导入tensorflow时,我收到以下错误:

 Failed to load the native TensorFlow runtime
 ImportError: DLL load failed: A dynamic link library (DLL) initialization routine failed

完整追溯:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\Technotronics Ltd\AppData\Local\conda\conda\envs\tensorflow\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
    from tensorflow.python import *  # pylint: disable=redefined-builtin
  File "C:\Users\Technotronics Ltd\AppData\Local\conda\conda\envs\tensorflow\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "C:\Users\Technotronics Ltd\AppData\Local\conda\conda\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in <module>
    raise ImportError(msg)
ImportError: Traceback (most recent call last):
  File "C:\Users\Technotronics Ltd\AppData\Local\conda\conda\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "C:\Users\Technotronics Ltd\AppData\Local\conda\conda\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "C:\Users\Technotronics Ltd\AppData\Local\conda\conda\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 17, in swig_import_helper
    return importlib.import_module(mname)
  File "C:\Users\Technotronics Ltd\AppData\Local\conda\conda\envs\tensorflow\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ImportError: DLL load failed: A dynamic link library (DLL) initialization routine failed.

1 个答案:

答案 0 :(得分:0)

旧版和低端CPU(无AVX)支持

如果您的CPU不支持AVX指令,则会出现ImportError:DLL加载失败:动态链接库(DLL)初始化例程失败。 (Win 10)或ImportError:使用Tensorflow官方版本1.6.0及更高版本时(DLL安装失败),错误代码为-1073741795(Win 7)(pip install tensorflow) 您可以使用pip install [filename] .whl从sse2文件夹下载该文件,而不使用官方的AVX二进制文件。

请参阅: https://github.com/fo40225/tensorflow-windows-wheel

对我有用