简体   繁体   English

导入 keras 时获取 DLL 加载失败

[英]Getting DLL load failed while importing keras

pip install keras点安装keras

import keras gives the following error:导入 keras 给出以下错误:

Using TensorFlow backend.使用 TensorFlow 后端。 ERROR:root:Internal Python error in the inspect module.错误:root:inspect 模块中的内部 Python 错误。 Below is the traceback from this internal error.下面是这个内部错误的回溯。 ERROR:root:Internal Python error in the inspect module.错误:root:inspect 模块中的内部 Python 错误。 Below is the traceback from this internal error.下面是这个内部错误的回溯。 Traceback (most recent call last): File "C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow_core\\python\\pywrap_tensorflow.py", line 58, in from tensorflow.python.pywrap_tensorflow_internal import * File "C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow_core\\python\\pywrap_tensorflow_internal.py", line 28, in _pywrap_tensorflow_internal = swig_import_helper() File "C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\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:\\ProgramData\\Anaconda3\\lib\\imp.py", line 242, in load_module return load_dynamic(name, filename, file) File "C:\\ProgramData\\Anaconda3\\lib\\imp.py", line 342, in load_dynamic return _load(spec) ImportError: DLL load failed: The specified module could not be found.回溯(最近一次调用):文件“C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow_core\\python\\pywrap_tensorflow.py”,第 58 行,来自 tensorflow.python.pywrap_tensorflow_internal import *文件“C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow_core\\python\\pywrap_tensorflow_internal.py”,第 28 行,在 _pywrap_tensorflow_internal = swig_import_helper() 文件“C:\\Users\\User\\AppData\\ Roaming\\Python\\Python37\\site-packages\\tensorflow_core\\python\\pywrap_tensorflow_internal.py”,第 24 行,在 swig_import_helper _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description) 文件“C:\\ProgramData\\Anaconda3\\lib \\imp.py", line 242, in load_module return load_dynamic(name, filename, file) File "C:\\ProgramData\\Anaconda3\\lib\\imp.py", line 342, in load_dynamic return _load(spec) ImportError: DLL load失败:找不到指定的模块。

During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\\ProgramData\\Anaconda3\\lib\\site-packages\\IPython\\core\\interactiveshell.py", line 3296, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "", line 1, in import keras File "C:\\ProgramData\\Anaconda3\\lib\\site-packages\\keras__init__.py", line 3, in from .在处理上述异常的过程中,发生了另一个异常:Traceback(最近一次调用最后一次):文件 "C:\\ProgramData\\Anaconda3\\lib\\site-packages\\IPython\\core\\interactiveshell.py", line 3296, in run_code exec( code_obj, self.user_global_ns, self.user_ns) 文件“”,第 1 行,导入 keras 文件“C:\\ProgramData\\Anaconda3\\lib\\site-packages\\keras__init__.py”,第 3 行,来自 . import utils File "C:\\ProgramData\\Anaconda3\\lib\\site-packages\\keras\\utils__init__.py", line 6, in from .导入 utils 文件“C:\\ProgramData\\Anaconda3\\lib\\site-packages\\keras\\utils__init__.py”,第 6 行,来自 . import conv_utils File "C:\\ProgramData\\Anaconda3\\lib\\site-packages\\keras\\utils\\conv_utils.py", line 9, in from .. import backend as K File "C:\\ProgramData\\Anaconda3\\lib\\site-packages\\keras\\backend__init__.py", line 1, in from .load_backend import epsilon File "C:\\ProgramData\\Anaconda3\\lib\\site-packages\\keras\\backend\\load_backend.py", line 90, in from .tensorflow_backend import * File "C:\\ProgramData\\Anaconda3\\lib\\site-packages\\keras\\backend\\tensorflow_backend.py", line 5, in import tensorflow as tf File "C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow__init__.py", line 101, in from tensorflow_core import * File "C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow_core__init__.py", line 40, in from tensorflow.python.tools import module_util as _module_util File "C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow__init__.py", line 50, in getattr module = self._load() File "C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-pac import conv_utils File "C:\\ProgramData\\Anaconda3\\lib\\site-packages\\keras\\utils\\conv_utils.py", line 9, in from .. import backend as K File "C:\\ProgramData\\Anaconda3\\lib\\site-包\\keras\\backend__init__.py”,第 1 行,从 .load_backend 导入 epsilon 文件“C:\\ProgramData\\Anaconda3\\lib\\site-packages\\keras\\backend\\load_backend.py”,第 90 行,从 .tensorflow_backend 导入* 文件“C:\\ site-packages\\tensorflow__init__.py”,第 101 行,来自 tensorflow_core 导入 * 文件“C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow_core__init__.py”,第 40 行,来自 tensorflow。 python.tools import module_util as _module_util File "C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow__init__.py", line 50, in getattr module = self._load() File "C:\\用户\\用户\\AppData\\Roaming\\Python\\Python37\\site-pac kages\\tensorflow__init__.py", line 44, in _load module = _importlib.import_module(self. kages\\tensorflow__init__.py”,第 44 行,在 _load module = _importlib.import_module(self. name ) File "C:\\ProgramData\\Anaconda3\\lib\\importlib__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow_core\\python__init__.py", line 49, in from tensorflow.python import pywrap_tensorflow File "C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow_core\\python\\pywrap_tensorflow.py", line 74, in raise ImportError(msg) ImportError: Traceback (most recent call last): File "C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow_core\\python\\pywrap_tensorflow.py", line 58, in from tensorflow.python.pywrap_tensorflow_internal import * File "C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow_core\\python\\pywrap_tensorflow_internal.py", line 28, in _pywrap_tensorflow_internal = swig_import_helper() File "C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow_core\\python\\pywrap_tensorflow_internal.py", lin name ) 文件 "C:\\ProgramData\\Anaconda3\\lib\\importlib__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "C:\\Users\\User\\AppData\\Roaming \\Python\\Python37\\site-packages\\tensorflow_core\\python__init__.py", line 49, in from tensorflow.python import pywrap_tensorflow File "C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow_core\\python \\pywrap_tensorflow.py",第 74 行,在 raise ImportError(msg) ImportError: Traceback (last last call last): File "C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow_core\\python\\ pywrap_tensorflow.py", line 58, in from tensorflow.python.pywrap_tensorflow_internal import * File "C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow_core\\python\\pywrap_tensorflow_internal.py", line 28,在 _pywrap_tensorflow_internal = swig_import_helper() 文件“C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow_core\\python\\pywrap_tensorflow_internal.py”中,林e 24, in swig_import_helper _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description) File "C:\\ProgramData\\Anaconda3\\lib\\imp.py", line 242, in load_module return load_dynamic(name, filename, file) File "C:\\ProgramData\\Anaconda3\\lib\\imp.py", line 342, in load_dynamic return _load(spec) ImportError: DLL load failed: The specified module could not be found. e 24, in swig_import_helper _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description) File "C:\\ProgramData\\Anaconda3\\lib\\imp.py", line 242, in load_module return load_dynamic(name, filename, file ) 文件 "C:\\ProgramData\\Anaconda3\\lib\\imp.py", line 342, in load_dynamic return _load(spec) ImportError: DLL load failed: The specified module could not be found. Failed to load the native TensorFlow runtime.无法加载本机 TensorFlow 运行时。

See https://www.tensorflow.org/install/errors for some common reasons and solutions.有关一些常见原因和解决方案,请参阅https://www.tensorflow.org/install/errors Include the entire stack trace above this error message when asking for help.寻求帮助时,请在此错误消息上方包含整个堆栈跟踪。

During handling of the above exception, another exception occurred:在处理上述异常的过程中,又发生了一个异常:

Traceback (most recent call last): File "C:\\ProgramData\\Anaconda3\\lib\\site-packages\\IPython\\core\\interactiveshell.py", line 2033, in showtraceback stb = value._render_traceback_() AttributeError: 'ImportError' object has no attribute '_render_traceback_'回溯(最近一次调用):文件“C:\\ProgramData\\Anaconda3\\lib\\site-packages\\IPython\\core\\interactiveshell.py”,第 2033 行,在 showtraceback stb = value._render_traceback_() AttributeError: 'ImportError' object没有属性“_render_traceback_”

During handling of the above exception, another exception occurred:在处理上述异常的过程中,又发生了一个异常:

Traceback (most recent call last): File "C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow_core\\python\\pywrap_tensorflow.py", line 58, in from tensorflow.python.pywrap_tensorflow_internal import * File "C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow_core\\python\\pywrap_tensorflow_internal.py", line 28, in _pywrap_tensorflow_internal = swig_import_helper() File "C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\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:\\ProgramData\\Anaconda3\\lib\\imp.py", line 242, in load_module return load_dynamic(name, filename, file) File "C:\\ProgramData\\Anaconda3\\lib\\imp.py", line 342, in load_dynamic return _load(spec) ImportError: DLL load failed: The specified module could not be found.回溯(最近一次调用):文件“C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow_core\\python\\pywrap_tensorflow.py”,第 58 行,来自 tensorflow.python.pywrap_tensorflow_internal import *文件“C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow_core\\python\\pywrap_tensorflow_internal.py”,第 28 行,在 _pywrap_tensorflow_internal = swig_import_helper() 文件“C:\\Users\\User\\AppData\\ Roaming\\Python\\Python37\\site-packages\\tensorflow_core\\python\\pywrap_tensorflow_internal.py”,第 24 行,在 swig_import_helper _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description) 文件“C:\\ProgramData\\Anaconda3\\lib \\imp.py", line 242, in load_module return load_dynamic(name, filename, file) File "C:\\ProgramData\\Anaconda3\\lib\\imp.py", line 342, in load_dynamic return _load(spec) ImportError: DLL load失败:找不到指定的模块。

During handling of the above exception, another exception occurred:在处理上述异常的过程中,又发生了一个异常:

Traceback (most recent call last): File "C:\\ProgramData\\Anaconda3\\lib\\site-packages\\IPython\\core\\ultratb.py", line 1095, in get_records return _fixed_getinnerframes(etb, number_of_lines_of_context, tb_offset) File "C:\\ProgramData\\Anaconda3\\lib\\site-packages\\IPython\\core\\ultratb.py", line 313, in wrapped return f(*args, **kwargs) File "C:\\ProgramData\\Anaconda3\\lib\\site-packages\\IPython\\core\\ultratb.py", line 347, in _fixed_getinnerframes records = fix_frame_records_filenames(inspect.getinnerframes(etb, context)) File "C:\\ProgramData\\Anaconda3\\lib\\inspect.py", line 1502, in getinnerframes frameinfo = (tb.tb_frame,) + getframeinfo(tb, context) File "C:\\ProgramData\\Anaconda3\\lib\\inspect.py", line 1460, in getframeinfo filename = getsourcefile(frame) or getfile(frame) File "C:\\ProgramData\\Anaconda3\\lib\\inspect.py", line 696, in getsourcefile if getattr(getmodule(object, filename), ' loader ', None) is not None: File "C:\\ProgramData\\Anaconda3\\lib\\inspect.py", line 733, in getmodule if ismodu回溯(最近一次调用):文件“C:\\ProgramData\\Anaconda3\\lib\\site-packages\\IPython\\core\\ultratb.py”,第 1095 行,在 get_records 中返回 _fixed_getinnerframes(etb, number_of_lines_of_context, tb_offset) 文件“C: \\ProgramData\\Anaconda3\\lib\\site-packages\\IPython\\core\\ultratb.py”,第 313 行,在包装返回 f(*args, **kwargs) 文件“C:\\ProgramData\\Anaconda3\\lib\\site-packages\\ IPython\\core\\ultratb.py”,第 347 行,在 _fixed_getinnerframes 记录 = fix_frame_records_filenames(inspect.getinnerframes(etb, context)) 文件“C:\\ProgramData\\Anaconda3\\lib\\inspect.py”,第 1502 行,在 getinnerframes frameinfo = (tb.tb_frame,) + getframeinfo(tb, context) File "C:\\ProgramData\\Anaconda3\\lib\\inspect.py", line 1460, in getframeinfo filename = getsourcefile(frame) or getfile(frame) File "C:\\ ProgramData\\Anaconda3\\lib\\inspect.py", line 696, in getsourcefile if getattr(getmodule(object, filename), ' loader ', None) 不是 None: File "C:\\ProgramData\\Anaconda3\\lib\\inspect.py ",第 733 行,在 getmodule 中,如果 ismodu le(module) and hasattr(module, ' file '): File "C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow__init__.py", line 50, in getattr module = self._load() File "C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow__init__.py", line 44, in _load module = _importlib.import_module(self. le(module) 和 hasattr(module, ' file '): File "C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow__init__.py", line 50, in getattr module = self._load () 文件“C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow__init__.py”,第 44 行,在 _load module = _importlib.import_module(self. name ) File "C:\\ProgramData\\Anaconda3\\lib\\importlib__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1006, in _gcd_import File "", line 983, in _find_and_load File "", line 953, in _find_and_load_unlocked File "", line 219, in _call_with_frames_removed File "", line 1006, in _gcd_import File "", line 983, in _find_and_load File "", line 967, in _find_and_load_unlocked File "", line 677, in _load_unlocked File "", line 728, in exec_module File "", line 219, in _call_with_frames_removed File "C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow_core__init__.py", line 42, in from . name ) 文件“C:\\ProgramData\\Anaconda3\\lib\\importlib__init__.py”,第 127 行,在 import_module 中 return _bootstrap._gcd_import(name[level:], package, level) 文件“”,第 1006 行,在 _gcd_import 文件“” , 第 983 行,在 _find_and_load File "" 中,第 953 行,在 _find_and_load_unlocked File "",第 219 行,在 _call_with_frames_removed File "",第 1006 行,在 _gcd_import File "",第 983 行,在 "_find_and_load_unlocked File",第 977 行_find_and_load_unlocked File "", line 677, in _load_unlocked File "", line 728, in exec_module File "", line 219, in _call_with_frames_removed File "C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-cores_initor__ .py”,第 42 行,来自 . _api.v2 import audio File "C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow_core_api\\v2\\audio__init__.py", line 10, in from tensorflow.python.ops.gen_audio_ops import decode_wav File "C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow_core\\python\\ops\\gen_audio_ops.py", line 9, in from tensorflow.python import pywrap_tensorflow as _pywrap_tensorflow File "C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow__init__.py", line 50, in getattr module = self._load() File "C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow__init__.py", line 44, in _load module = _importlib.import_module(self. name ) File "C:\\ProgramData\\Anaconda3\\lib\\importlib__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow_core\\python__init__.py", line 49, in from tensorflow.python import pywrap_tensorflow File "C:\\User _api.v2 导入音频文件“C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow_core_api\\v2\\audio__init__.py”,第 10 行,来自 tensorflow.python.ops.gen_audio_ops import decode_wav 文件"C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow_core\\python\\ops\\gen_audio_ops.py", line 9, in from tensorflow.python import pywrap_tensorflow as _pywrap_tensorflow File "C:\\Users\\ User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow__init__.py”,第 50 行,在getattr模块 = self._load() 文件“C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site- 。软件包\\ tensorflow__init __ PY”,第44行,在模块_load = _importlib.import_module(自)文件“C:\\ ProgramData \\ Anaconda3 \\ lib中\\ importlib__init __ PY”,线127,在返回import_module _bootstrap._gcd_import(名称[ level:], package, level) 文件 "C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow_core\\python__init__.py", line 49, in from tensorflow.python import pywrap_tensorflow File "C: \\用户s\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow_core\\python\\pywrap_tensorflow.py", line 74, in raise ImportError(msg) ImportError: Traceback (most recent call last): File "C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow_core\\python\\pywrap_tensorflow.py", line 58, in from tensorflow.python.pywrap_tensorflow_internal import * File "C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow_core\\python\\pywrap_tensorflow_internal.py", line 28, in _pywrap_tensorflow_internal = swig_import_helper() File "C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\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:\\ProgramData\\Anaconda3\\lib\\imp.py", line 242, in load_module return load_dynamic(name, filename, file) File "C:\\ProgramData\\Anaconda3\\lib\\imp.py", line 342, in load_dynamic return _load(spec) ImportError: DLL l s\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow_core\\python\\pywrap_tensorflow.py”,第 74 行,在 raise ImportError(msg) ImportError: Traceback (last last call last): File "C:\\Users \\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow_core\\python\\pywrap_tensorflow.py”,第 58 行,来自 tensorflow.python.pywrap_tensorflow_internal import * 文件“C:\\Users\\User\\AppData\\Roaming\\Python \\Python37\\site-packages\\tensorflow_core\\python\\pywrap_tensorflow_internal.py”,第 28 行,在 _pywrap_tensorflow_internal = swig_import_helper() 文件“C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow_core\\python\\ pywrap_tensorflow_internal.py”,第 24 行,在 swig_import_helper _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description) File "C:\\ProgramData\\Anaconda3\\lib\\imp.py", line 242, in load_module return load_dynamic( name, filename, file) File "C:\\ProgramData\\Anaconda3\\lib\\imp.py", line 342, in load_dynamic return _load(spec) ImportError: DLL l oad failed: The specified module could not be found. oad 失败:找不到指定的模块。

During handling of the above exception, another exception occurred:在处理上述异常的过程中,又发生了一个异常:

Traceback (most recent call last): File "C:\\ProgramData\\Anaconda3\\lib\\site-packages\\IPython\\core\\interactiveshell.py", line 3296, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "", line 1, in import keras File "C:\\ProgramData\\Anaconda3\\lib\\site-packages\\keras__init__.py", line 3, in from .回溯(最近一次调用):文件“C:\\ProgramData\\Anaconda3\\lib\\site-packages\\IPython\\core\\interactiveshell.py”,第 3296 行,在 run_code exec(code_obj, self.user_global_ns, self.user_ns) 文件中"",第 1 行,导入 keras 文件“C:\\ProgramData\\Anaconda3\\lib\\site-packages\\keras__init__.py”,第 3 行,来自 . import utils File "C:\\ProgramData\\Anaconda3\\lib\\site-packages\\keras\\utils__init__.py", line 6, in from .导入 utils 文件“C:\\ProgramData\\Anaconda3\\lib\\site-packages\\keras\\utils__init__.py”,第 6 行,来自 . import conv_utils File "C:\\ProgramData\\Anaconda3\\lib\\site-packages\\keras\\utils\\conv_utils.py", line 9, in from .. import backend as K File "C:\\ProgramData\\Anaconda3\\lib\\site-packages\\keras\\backend__init__.py", line 1, in from .load_backend import epsilon File "C:\\ProgramData\\Anaconda3\\lib\\site-packages\\keras\\backend\\load_backend.py", line 90, in from .tensorflow_backend import * File "C:\\ProgramData\\Anaconda3\\lib\\site-packages\\keras\\backend\\tensorflow_backend.py", line 5, in import tensorflow as tf File "C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow__init__.py", line 101, in from tensorflow_core import * File "C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow_core__init__.py", line 40, in from tensorflow.python.tools import module_util as _module_util File "C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow__init__.py", line 50, in getattr module = self._load() File "C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-pac import conv_utils File "C:\\ProgramData\\Anaconda3\\lib\\site-packages\\keras\\utils\\conv_utils.py", line 9, in from .. import backend as K File "C:\\ProgramData\\Anaconda3\\lib\\site-包\\keras\\backend__init__.py”,第 1 行,从 .load_backend 导入 epsilon 文件“C:\\ProgramData\\Anaconda3\\lib\\site-packages\\keras\\backend\\load_backend.py”,第 90 行,从 .tensorflow_backend 导入* 文件“C:\\ site-packages\\tensorflow__init__.py”,第 101 行,来自 tensorflow_core 导入 * 文件“C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow_core__init__.py”,第 40 行,来自 tensorflow。 python.tools import module_util as _module_util File "C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow__init__.py", line 50, in getattr module = self._load() File "C:\\用户\\用户\\AppData\\Roaming\\Python\\Python37\\site-pac kages\\tensorflow__init__.py", line 44, in _load module = _importlib.import_module(self. kages\\tensorflow__init__.py”,第 44 行,在 _load module = _importlib.import_module(self. name ) File "C:\\ProgramData\\Anaconda3\\lib\\importlib__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow_core\\python__init__.py", line 49, in from tensorflow.python import pywrap_tensorflow File "C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow_core\\python\\pywrap_tensorflow.py", line 74, in raise ImportError(msg) ImportError: Traceback (most recent call last): File "C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow_core\\python\\pywrap_tensorflow.py", line 58, in from tensorflow.python.pywrap_tensorflow_internal import * File "C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow_core\\python\\pywrap_tensorflow_internal.py", line 28, in _pywrap_tensorflow_internal = swig_import_helper() File "C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow_core\\python\\pywrap_tensorflow_internal.py", lin name ) 文件“C:\\ProgramData\\Anaconda3\\lib\\importlib__init__.py”,第 127 行,在 import_module 中 return _bootstrap._gcd_import(name[level:], package, level) 文件“C:\\Users\\User\\AppData\\Roaming \\Python\\Python37\\site-packages\\tensorflow_core\\python__init__.py", line 49, in from tensorflow.python import pywrap_tensorflow File "C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow_core\\python \\pywrap_tensorflow.py”,第 74 行,在 raise ImportError(msg) ImportError: Traceback (last last call last): File "C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow_core\\python\\ pywrap_tensorflow.py", line 58, in from tensorflow.python.pywrap_tensorflow_internal import * File "C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow_core\\python\\pywrap_tensorflow_internal.py", line 28,在 _pywrap_tensorflow_internal = swig_import_helper() 文件“C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow_core\\python\\pywrap_tensorflow_internal.py”中,林e 24, in swig_import_helper _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description) File "C:\\ProgramData\\Anaconda3\\lib\\imp.py", line 242, in load_module return load_dynamic(name, filename, file) File "C:\\ProgramData\\Anaconda3\\lib\\imp.py", line 342, in load_dynamic return _load(spec) ImportError: DLL load failed: The specified module could not be found. e 24, in swig_import_helper _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description) File "C:\\ProgramData\\Anaconda3\\lib\\imp.py", line 242, in load_module return load_dynamic(name, filename, file ) File "C:\\ProgramData\\Anaconda3\\lib\\imp.py", line 342, in load_dynamic return _load(spec) ImportError: DLL load failed: The specified module could not be found.

Failed to load the native TensorFlow runtime.无法加载本机 TensorFlow 运行时。

See https://www.tensorflow.org/install/errors请参阅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.寻求帮助时,请在此错误消息上方包含整个堆栈跟踪。

During handling of the above exception, another exception occurred:在处理上述异常的过程中,又发生了一个异常:

Traceback (most recent call last): File "C:\\ProgramData\\Anaconda3\\lib\\site-packages\\IPython\\core\\interactiveshell.py", line 2033, in showtraceback stb = value._render_traceback_() AttributeError: 'ImportError' object has no attribute '_render_traceback_'回溯(最近一次调用):文件“C:\\ProgramData\\Anaconda3\\lib\\site-packages\\IPython\\core\\interactiveshell.py”,第 2033 行,在 showtraceback stb = value._render_traceback_() AttributeError: 'ImportError' object没有属性“_render_traceback_”

During handling of the above exception, another exception occurred:在处理上述异常的过程中,又发生了一个异常:

Traceback (most recent call last): File "C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow_core\\python\\pywrap_tensorflow.py", line 58, in from tensorflow.python.pywrap_tensorflow_internal import * File "C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow_core\\python\\pywrap_tensorflow_internal.py", line 28, in _pywrap_tensorflow_internal = swig_import_helper() File "C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\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:\\ProgramData\\Anaconda3\\lib\\imp.py", line 242, in load_module return load_dynamic(name, filename, file) File "C:\\ProgramData\\Anaconda3\\lib\\imp.py", line 342, in load_dynamic return _load(spec) ImportError: DLL load failed: The specified module could not be found.回溯(最近一次调用):文件“C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow_core\\python\\pywrap_tensorflow.py”,第 58 行,来自 tensorflow.python.pywrap_tensorflow_internal import *文件“C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow_core\\python\\pywrap_tensorflow_internal.py”,第 28 行,在 _pywrap_tensorflow_internal = swig_import_helper() 文件“C:\\Users\\User\\AppData\\ Roaming\\Python\\Python37\\site-packages\\tensorflow_core\\python\\pywrap_tensorflow_internal.py”,第 24 行,在 swig_import_helper _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description) 文件“C:\\ProgramData\\Anaconda3\\lib \\imp.py", line 242, in load_module return load_dynamic(name, filename, file) File "C:\\ProgramData\\Anaconda3\\lib\\imp.py", line 342, in load_dynamic return _load(spec) ImportError: DLL load失败:找不到指定的模块。 Failed to load the native TensorFlow runtime.无法加载本机 TensorFlow 运行时。 See https://www.tensorflow.org/install/errors for some common reasons and solutions.有关一些常见原因和解决方案,请参阅https://www.tensorflow.org/install/errors Include the entire stack trace above this error message when asking for help.寻求帮助时,请在此错误消息上方包含整个堆栈跟踪。 Traceback (most recent call last): File "C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow_core\\python\\pywrap_tensorflow.py", line 58, in from tensorflow.python.pywrap_tensorflow_internal import * File "C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow_core\\python\\pywrap_tensorflow_internal.py", line 28, in _pywrap_tensorflow_internal = swig_import_helper() File "C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\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:\\ProgramData\\Anaconda3\\lib\\imp.py", line 242, in load_module return load_dynamic(name, filename, file) File "C:\\ProgramData\\Anaconda3\\lib\\imp.py", line 342, in load_dynamic return _load(spec) ImportError: DLL load failed: The specified module could not be found.回溯(最近一次调用):文件“C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow_core\\python\\pywrap_tensorflow.py”,第 58 行,来自 tensorflow.python.pywrap_tensorflow_internal import *文件“C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow_core\\python\\pywrap_tensorflow_internal.py”,第 28 行,在 _pywrap_tensorflow_internal = swig_import_helper() 文件“C:\\Users\\User\\AppData\\ Roaming\\Python\\Python37\\site-packages\\tensorflow_core\\python\\pywrap_tensorflow_internal.py”,第 24 行,在 swig_import_helper _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description) 文件“C:\\ProgramData\\Anaconda3\\lib \\imp.py", line 242, in load_module return load_dynamic(name, filename, file) File "C:\\ProgramData\\Anaconda3\\lib\\imp.py", line 342, in load_dynamic return _load(spec) ImportError: DLL load失败:找不到指定的模块。 During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\\ProgramData\\Anaconda3\\lib\\site-packages\\IPython\\core\\interactiveshell.py", line 3296, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "", line 1, in import keras File "C:\\ProgramData\\Anaconda3\\lib\\site-packages\\keras__init__.py", line 3, in from .在处理上述异常的过程中,发生了另一个异常:Traceback(最近一次调用最后一次):文件 "C:\\ProgramData\\Anaconda3\\lib\\site-packages\\IPython\\core\\interactiveshell.py", line 3296, in run_code exec( code_obj, self.user_global_ns, self.user_ns) 文件“”,第 1 行,导入 keras 文件“C:\\ProgramData\\Anaconda3\\lib\\site-packages\\keras__init__.py”,第 3 行,来自 . import utils File "C:\\ProgramData\\Anaconda3\\lib\\site-packages\\keras\\utils__init__.py", line 6, in from .导入 utils 文件“C:\\ProgramData\\Anaconda3\\lib\\site-packages\\keras\\utils__init__.py”,第 6 行,来自 . import conv_utils File "C:\\ProgramData\\Anaconda3\\lib\\site-packages\\keras\\utils\\conv_utils.py", line 9, in from .. import backend as K File "C:\\ProgramData\\Anaconda3\\lib\\site-packages\\keras\\backend__init__.py", line 1, in from .load_backend import epsilon File "C:\\ProgramData\\Anaconda3\\lib\\site-packages\\keras\\backend\\load_backend.py", line 90, in from .tensorflow_backend import * File "C:\\ProgramData\\Anaconda3\\lib\\site-packages\\keras\\backend\\tensorflow_backend.py", line 5, in import tensorflow as tf File "C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow__init__.py", line 101, in from tensorflow_core import * File "C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow_core__init__.py", line 40, in from tensorflow.python.tools import module_util as _module_util File "C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow__init__.py", line 50, in getattr module = self._load() File "C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-pac import conv_utils File "C:\\ProgramData\\Anaconda3\\lib\\site-packages\\keras\\utils\\conv_utils.py", line 9, in from .. import backend as K File "C:\\ProgramData\\Anaconda3\\lib\\site-包\\keras\\backend__init__.py”,第 1 行,从 .load_backend 导入 epsilon 文件“C:\\ProgramData\\Anaconda3\\lib\\site-packages\\keras\\backend\\load_backend.py”,第 90 行,从 .tensorflow_backend 导入* 文件“C:\\ site-packages\\tensorflow__init__.py”,第 101 行,来自 tensorflow_core 导入 * 文件“C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow_core__init__.py”,第 40 行,来自 tensorflow。 python.tools import module_util as _module_util File "C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow__init__.py", line 50, in getattr module = self._load() File "C:\\用户\\用户\\AppData\\Roaming\\Python\\Python37\\site-pac kages\\tensorflow__init__.py", line 44, in _load module = _importlib.import_module(self. kages\\tensorflow__init__.py”,第 44 行,在 _load module = _importlib.import_module(self. name ) File "C:\\ProgramData\\Anaconda3\\lib\\importlib__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow_core\\python__init__.py", line 49, in from tensorflow.python import pywrap_tensorflow File "C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow_core\\python\\pywrap_tensorflow.py", line 74, in raise ImportError(msg) ImportError: Traceback (most recent call last): File "C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow_core\\python\\pywrap_tensorflow.py", line 58, in from tensorflow.python.pywrap_tensorflow_internal import * File "C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow_core\\python\\pywrap_tensorflow_internal.py", line 28, in _pywrap_tensorflow_internal = swig_import_helper() File "C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow_core\\python\\pywrap_tensorflow_internal.py", lin name ) 文件 "C:\\ProgramData\\Anaconda3\\lib\\importlib__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "C:\\Users\\User\\AppData\\Roaming \\Python\\Python37\\site-packages\\tensorflow_core\\python__init__.py", line 49, in from tensorflow.python import pywrap_tensorflow File "C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow_core\\python \\pywrap_tensorflow.py”,第 74 行,在 raise ImportError(msg) ImportError: Traceback (last last call last): File "C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow_core\\python\\ pywrap_tensorflow.py", line 58, in from tensorflow.python.pywrap_tensorflow_internal import * File "C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow_core\\python\\pywrap_tensorflow_internal.py", line 28,在 _pywrap_tensorflow_internal = swig_import_helper() 文件“C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow_core\\python\\pywrap_tensorflow_internal.py”中,林e 24, in swig_import_helper _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description) File "C:\\ProgramData\\Anaconda3\\lib\\imp.py", line 242, in load_module return load_dynamic(name, filename, file) File "C:\\ProgramData\\Anaconda3\\lib\\imp.py", line 342, in load_dynamic return _load(spec) ImportError: DLL load failed: The specified module could not be found. e 24, in swig_import_helper _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description) File "C:\\ProgramData\\Anaconda3\\lib\\imp.py", line 242, in load_module return load_dynamic(name, filename, file ) File "C:\\ProgramData\\Anaconda3\\lib\\imp.py", line 342, in load_dynamic return _load(spec) ImportError: DLL load failed: The specified module could not be found. Failed to load the native TensorFlow runtime.无法加载本机 TensorFlow 运行时。 See https://www.tensorflow.org/install/errors for some common reasons and solutions.有关一些常见原因和解决方案,请参阅https://www.tensorflow.org/install/errors Include the entire stack trace above this error message when asking for help.寻求帮助时,请在此错误消息上方包含整个堆栈跟踪。 During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow_core\\python\\pywrap_tensorflow.py", line 58, in from tensorflow.python.pywrap_tensorflow_internal import * File "C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow_core\\python\\pywrap_tensorflow_internal.py", line 28, in _pywrap_tensorflow_internal = swig_import_helper() File "C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\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:\\ProgramData\\Anaconda3\\lib\\imp.py", line 242, in load_module return load_dynamic(name, filename, file) File "C:\\ProgramData\\Anaconda3\\lib\\imp.py", line 342, in load_dynamic return _load(spec) ImportError: DLL load failed: The specified module could not be found.在处理上述异常的过程中,发生了另一个异常:Traceback(最近一次调用最后一次):文件“C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow_core\\python\\pywrap_tensorflow.py”,行58, in from tensorflow.python.pywrap_tensorflow_internal import * File "C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow_core\\python\\pywrap_tensorflow_internal.py", line 28, in _pywrap_tensorflow_internal = swig_import_help文件“C:\\Users\\User\\AppData\\Roaming\\Python\\Python37\\site-packages\\tensorflow_core\\python\\pywrap_tensorflow_internal.py”,第 24 行,在 swig_import_helper _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description ) 文件 "C:\\ProgramData\\Anaconda3\\lib\\imp.py", line 242, in load_module return load_dynamic(name, filename, file) 文件 "C:\\ProgramData\\Anaconda3\\lib\\imp.py", line 342,在 load_dynamic 返回 _load(spec) ImportError: DLL load failed: 找不到指定的模块。 Failed to load the native TensorFlow runtime.无法加载本机 TensorFlow 运行时。 See https://www.tensorflow.org/install/errors for some common reasons and solutions.有关一些常见原因和解决方案,请参阅https://www.tensorflow.org/install/errors Include the entire stack trace above this error message when asking for help.寻求帮助时,请在此错误消息上方包含整个堆栈跟踪。

Nothing to do with Keras, it's your installation of Tensorflow that's not correct.与 Keras 无关,是您安装的 Tensorflow 不正确。 Try to run python -c 'import tensorflow' .尝试运行python -c 'import tensorflow' It should fail in your current situation.在您目前的情况下,它应该会失败。

If you're using Tensorflow-GPU, installation of required third party software can be tricky.如果您使用的是 Tensorflow-GPU,安装所需的第三方软件可能会很棘手。 You'll find instructions here: https://www.tensorflow.org/install/gpu您可以在此处找到说明: https : //www.tensorflow.org/install/gpu

For Tensorflow-CPU, installation may sometimes fail if your processor does not support AVX instructions (At a certain point, Tensorflow started to use AVX during build, so if your processor does not support it, import will crash).对于 Tensorflow-CPU,如果您的处理器不支持 AVX 指令,安装有时可能会失败(在某个时刻,Tensorflow 在构建期间开始使用 AVX,因此如果您的处理器不支持,导入将崩溃)。 In this case, you need to install an older version.在这种情况下,您需要安装旧版本。

I'm not sure but I think Tensorflow 1.12 is the latest version before they started to enable AVX.我不确定,但我认为 Tensorflow 1.12 是他们开始启用 AVX 之前的最新版本。 Give it a try with:试试看:

pip install tensorflow==1.12

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM