【异常】keras / tensorflow安装报错

文章目录

  • 错误一:
  • 错误二:
  • 错误三
  • 参考

错误一:

  • 在导入包import tensorflow时,报一下错误:
Traceback (most recent call last):
  File "C:\Users\dell\AppData\Roaming\Python\Python36\site-packages\tensorflow_core\python\pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "C:\Users\dell\AppData\Roaming\Python\Python36\site-packages\tensorflow_core\python\pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "C:\Users\dell\AppData\Roaming\Python\Python36\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 "D:\ananconda\lib\imp.py", line 243, in load_module
    return load_dynamic(name, filename, file)
  File "D:\ananconda\lib\imp.py", line 343, in load_dynamic
    return _load(spec)
ImportError: DLL load failed: 找不到指定的模块。

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "", line 1, in <module>
  File "C:\Users\dell\AppData\Roaming\Python\Python36\site-packages\tensorflow\__init__.py", line 101, in <module>
    from tensorflow_core import *
  File "C:\Users\dell\AppData\Roaming\Python\Python36\site-packages\tensorflow_core\__init__.py", line 42, in <module>
    from . _api.v2 import audio
  File "C:\Users\dell\AppData\Roaming\Python\Python36\site-packages\tensorflow_core\_api\v2\audio\__init__.py", line 10, in <module>
    from tensorflow.python.ops.gen_audio_ops import decode_wav
  File "C:\Users\dell\AppData\Roaming\Python\Python36\site-packages\tensorflow_core\python\ops\gen_audio_ops.py", line 9, in <module>
    from tensorflow.python import pywrap_tensorflow as _pywrap_tensorflow
  File "C:\Users\dell\AppData\Roaming\Python\Python36\site-packages\tensorflow\__init__.py", line 50, in __getattr__
    module = self._load()
  File "C:\Users\dell\AppData\Roaming\Python\Python36\site-packages\tensorflow\__init__.py", line 44, in _load
    module = _importlib.import_module(self.__name__)
  File "D:\ananconda\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "C:\Users\dell\AppData\Roaming\Python\Python36\site-packages\tensorflow_core\python\__init__.py", line 49, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "C:\Users\dell\AppData\Roaming\Python\Python36\site-packages\tensorflow_core\python\pywrap_tensorflow.py", line 74, in <module>
    raise ImportError(msg)
ImportError: Traceback (most recent call last):
  File "C:\Users\dell\AppData\Roaming\Python\Python36\site-packages\tensorflow_core\python\pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "C:\Users\dell\AppData\Roaming\Python\Python36\site-packages\tensorflow_core\python\pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "C:\Users\dell\AppData\Roaming\Python\Python36\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 "D:\ananconda\lib\imp.py", line 243, in load_module
    return load_dynamic(name, filename, file)
  File "D:\ananconda\lib\imp.py", line 343, in load_dynamic
    return _load(spec)
ImportError: DLL load failed: 找不到指定的模块。


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.
  • 解决办法:

在conda安装的时候,路径为 D:\ananconda\Lib\site-packages ,但是报错时显示下面这个位置的tensorflow有错误,"C:\Users\dell\AppData\Roaming\Python\Python36\site-packages\tensorflow\__init__.py",过去查看,果然有其他的python环境,把python文件夹删除后再重新使用conda安装tensorflow就好了。

错误二:

  • 在导入包import keras时,报以下错误:
ImportError:cannot import name 'tf_utils'
  • 解决办法:
    不同的keras和不同的tensorflow之间有对应关系,具体对应关系如下
    keras和tensorflow对照表
    【异常】keras / tensorflow安装报错_第1张图片

错误三

  • 安装包conda install tensorflow,报以下错误
tensorboard 1.14.0 has requirement setuptools>=41.0.0, but you’ll have setuptools 39.0.1 which is incompatible.
  • 解决办法
conda install setuptools==41.0.0

参考

查看anaconda安装库/包的位置(路径)

win10加python3.7安装tensorflow以及keras遇到的问题
win10 python3.7 Anaconda3 安装tensorflow+Keras
keras和tensorflow对照表
python3.7如何解决安装tensorflow的问题
tensorboard 1.14.0 has requirement setuptools>=41.0.0, but you’ll have setuptools 39.0.1
AttributeError: module ‘keras_applications’ has no attribute ‘set_keras_submodules’
Ubuntu系统在Anaconda中安装Python3.6的虚拟环境

你可能感兴趣的:(异常,python,anaconda,tensorflow)