未能加载原生 TensorFlow 运行时 - DLL 加载失败
Posted
技术标签:
【中文标题】未能加载原生 TensorFlow 运行时 - DLL 加载失败【英文标题】:Failed to load the native TensorFlow runtime - DLL load failed 【发布时间】:2021-01-07 19:40:14 【问题描述】:不知道如何处理:
DLL 加载失败:Det går inte att hitta den angivna modulen(瑞典语:找不到所需的模块) 未能加载原生 TensorFlow 运行时。目前我无法用 tensorflow 做任何事情。
(spyder-env2) PS C:\> python -c "import tensorflow as tf;print(tf.reduce_sum(tf.random.normal([1000, 1000])))"
TRACEBACK:
Traceback (most recent call last):
File "C:\Users\eid\AppData\Local\Continuum\anaconda2\envs\tensorflow36\envs\spyder-env2\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 64, in <module>
from tensorflow.python._pywrap_tensorflow_internal import *
ImportError: DLL load failed: Det går inte att hitta den angivna modulen.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\eid\AppData\Local\Continuum\anaconda2\envs\tensorflow36\envs\spyder-env2\lib\site-packages\tensorflow\__init__.py", line 41, in <module>
from tensorflow.python.tools import module_util as _module_util
File "C:\Users\eid\AppData\Local\Continuum\anaconda2\envs\tensorflow36\envs\spyder-
env2\lib\site-packages\tensorflow\python\__init__.py", line 40, in <module>
from tensorflow.python.eager import context
File "C:\Users\eid\AppData\Local\Continuum\anaconda2\envs\tensorflow36\envs\spyder-env2\lib\site-packages\tensorflow\python\eager\context.py", line 35, in <module>
from tensorflow.python import pywrap_tfe
File "C:\Users\eid\AppData\Local\Continuum\anaconda2\envs\tensorflow36\envs\spyder-env2\lib\site-packages\tensorflow\python\pywrap_tfe.py", line 28, in <module>
from tensorflow.python import pywrap_tensorflow
File "C:\Users\eid\AppData\Local\Continuum\anaconda2\envs\tensorflow36\envs\spyder-env2\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 83, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Users\eid\AppData\Local\Continuum\anaconda2\envs\tensorflow36\envs\spyder-env2\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 64, in <module>
from tensorflow.python._pywrap_tensorflow_internal import *
ImportError: DLL load failed: Det går inte att hitta den angivna modulen.
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.org/install/errors 了解一些常见原因和解决方案。在寻求帮助时,请在此错误消息上方包含整个堆栈跟踪。”这是你做的吗? 【参考方案1】:此问题可能是因为 Tensorflow 需要 MSVC 2019 可再发行版或您的 CPU 不支持 AVX2 指令或您的 CPU/Python 为 32 位。
有一种解决方法,要么您必须从源代码构建 Tensorflow,要么使用 google colaboratory 工作。 使用here 中提到的指令从源代码编译。
【讨论】:
以上是关于未能加载原生 TensorFlow 运行时 - DLL 加载失败的主要内容,如果未能解决你的问题,请参考以下文章
Tensorflow 安装问题:无法加载原生 TensorFlow 运行时
Django webapplication 加载原生 TensorFlow 运行时失败。在 Heroku
无法加载原生 TensorFlow 运行时。运行 g2p-seq2seq --version 时
ASP.NET运行时错误:未能加载文件或程序集或它的某一依赖项.参数错误.