ImportError:DLL加载失败:找不到指定的模块。(Keras)

时间:2020-03-29 20:23:24

标签: python tensorflow keras

首先,我在anaconda导航器中创建了一个环境,在其中安装了Keras,Tensorflow和Theano等软件包。

现在,我已经通过anaconda导航器激活了我的环境,并启动了Spyder应用程序。 现在,当我尝试导入keras时,显示错误提示:

Traceback (most recent call last):
  File "C:\Users\Quickhotshot612\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow_core\python\pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "C:\Users\Quickhotshot612\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow_core\python\pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "C:\Users\Quickhotshot612\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow_core\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper
    _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
  File "C:\Users\Quickhotshot612\Anaconda3\envs\tensorflow\lib\imp.py", line 242, in load_module
    return load_dynamic(name, filename, file)
  File "C:\Users\Quickhotshot612\Anaconda3\envs\tensorflow\lib\imp.py", line 342, in load_dynamic
    return _load(spec)
ImportError: DLL load failed: The specified module could not be found.

无法加载本机TensorFlow运行时。

请参见https://www.tensorflow.org/install/errors

出于某些常见原因和解决方案。包括整个堆栈跟踪 寻求帮助时,此错误消息上方。

并且不断像无限一样显示错误。 我哪里做错了?任何人都可以帮助我。enter image description here

但是当我给(导入theano)时,它正在工作,但在tensorflow和keras情况下却没有。

2 个答案:

答案 0 :(得分:0)

是的,我有点想通了,它对我有用!

1)检查pip,setuptools和wheel是否最新。
2)如果您在使用包装库进行安装时遇到错误。“ conda remove wrapt”,然后“ pip install tensorflow”
3)此外,您还应该在计算机或更高版本中安装Microsoft Visual C ++ Redistributable for Visual Stuido2015。
4)然后尝试导入tensorflow或tensorflow.keras

如果仍然显示ImportError。打开导航器并通过选择该环境直接在此处安装tensorflow,然后转到未安装,然后搜索tensorflow并下载软件包。它将自动将软件包添加到您的环境中,然后打开say spyder并尝试在内核中导入tensorflow。

这很好。

即使您遇到点子错误,即无法导入名称“ Flowcontrol”,您也可以尝试此方法。

和平!

答案 1 :(得分:0)

我通过将Tensorflow降级到2.0版解决了这个问题

pip install --user tensorflow==2.0

每个Github enter link description here

我的平台: 赢10 的Python 3.7 tensorflow 2.1