Python 如何通过导入keras解决此问题?
我使用Anaconda提示符安装并更新了Tensorflow和Keras我有Keras 2.3.1和tensorflow 2.4.1。最初,我有“Keras需要tensorflwo 2.2或更高版本”的错误,即使tensorflow版本为2.4.1。我重新安装了Anaconda并再次安装了所有软件包。我现在是另一个问题。错误如下。请帮我进口可乐。先谢谢你Python 如何通过导入keras解决此问题?,python,tensorflow,keras,Python,Tensorflow,Keras,我使用Anaconda提示符安装并更新了Tensorflow和Keras我有Keras 2.3.1和tensorflow 2.4.1。最初,我有“Keras需要tensorflwo 2.2或更高版本”的错误,即使tensorflow版本为2.4.1。我重新安装了Anaconda并再次安装了所有软件包。我现在是另一个问题。错误如下。请帮我进口可乐。先谢谢你 ImportError Traceback (most recent call
ImportError Traceback (most recent call last)
~\AppData\Roaming\Python\Python38\site-packages\tensorflow\python\pywrap_tensorflow.py in <module>
63 try:
---> 64 from tensorflow.python._pywrap_tensorflow_internal import *
65 # This try catch logic is because there is no bazel equivalent for py_extension.
ImportError: DLL load failed while importing _pywrap_tensorflow_internal: The specified module could not be found.
During handling of the above exception, another exception occurred:
ImportError Traceback (most recent call last)
<ipython-input-9-88d96843a926> in <module>
----> 1 import keras
~\Anaconda3\lib\site-packages\keras\__init__.py in <module>
1 from __future__ import absolute_import
2
----> 3 from . import utils
4 from . import activations
5 from . import applications
~\Anaconda3\lib\site-packages\keras\utils\__init__.py in <module>
4 from . import data_utils
5 from . import io_utils
----> 6 from . import conv_utils
7 from . import losses_utils
8 from . import metrics_utils
~\Anaconda3\lib\site-packages\keras\utils\conv_utils.py in <module>
7 from six.moves import range
8 import numpy as np
----> 9 from .. import backend as K
10
11
~\Anaconda3\lib\site-packages\keras\backend\__init__.py in <module>
----> 1 from .load_backend import epsilon
2 from .load_backend import set_epsilon
3 from .load_backend import floatx
4 from .load_backend import set_floatx
5 from .load_backend import cast_to_floatx
~\Anaconda3\lib\site-packages\keras\backend\load_backend.py in <module>
88 elif _BACKEND == 'tensorflow':
89 sys.stderr.write('Using TensorFlow backend.\n')
---> 90 from .tensorflow_backend import *
91 else:
92 # Try and load external backend.
~\Anaconda3\lib\site-packages\keras\backend\tensorflow_backend.py in <module>
3 from __future__ import print_function
4
----> 5 import tensorflow as tf
6 from tensorflow.python.eager import context
7 from tensorflow.python.framework import device as tfdev
~\AppData\Roaming\Python\Python38\site-packages\tensorflow\__init__.py in <module>
39 import sys as _sys
40
---> 41 from tensorflow.python.tools import module_util as _module_util
42 from tensorflow.python.util.lazy_loader import LazyLoader as _LazyLoader
43
~\AppData\Roaming\Python\Python38\site-packages\tensorflow\python\__init__.py in <module>
37 # go/tf-wildcard-import
38 # pylint: disable=wildcard-import,g-bad-import-order,g-import-not-at-top
---> 39 from tensorflow.python import pywrap_tensorflow as _pywrap_tensorflow
40
41 from tensorflow.python.eager import context
~\AppData\Roaming\Python\Python38\site-packages\tensorflow\python\pywrap_tensorflow.py in <module>
81 for some common reasons and solutions. Include the entire stack trace
82 above this error message when asking for help.""" % traceback.format_exc()
---> 83 raise ImportError(msg)
84
85 # pylint: enable=wildcard-import,g-import-not-at-top,unused-import,line-too-long
ImportError: Traceback (most recent call last):
File "C:\Users\T6518BB\AppData\Roaming\Python\Python38\site-packages\tensorflow\python\pywrap_tensorflow.py", line 64, in <module>
from tensorflow.python._pywrap_tensorflow_internal import *
ImportError: DLL load failed while importing _pywrap_tensorflow_internal: The specified module could not be found.
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.
ImportError回溯(最近一次呼叫最后一次)
中的~\AppData\Roaming\Python\Python38\site packages\tensorflow\Python\pywrap\u tensorflow.py
63尝试:
--->64从tensorflow.python.\u pywrap\u tensorflow\u内部导入*
65#这种try-catch逻辑是因为py#u扩展没有bazel等价物。
导入错误:导入_pywrap_tensorflow_internal时DLL加载失败:找不到指定的模块。
在处理上述异常期间,发生了另一个异常:
ImportError回溯(最近一次呼叫最后一次)
在里面
---->1进口干酪
~\Anaconda3\lib\site packages\keras\\uuuuu init\uuuuuuuuu.py in
1来自未来导入绝对导入
2.
---->3从。导入UTIL
4来自。导入激活
5从。导入应用程序
~\Anaconda3\lib\site packages\keras\utils\\uuuuuu init\uuuuuuuuuu.py in
4来自。导入数据工具
5从。导入io_utils
---->6从。导入conv_utils
7从。进口损失
8从。导入度量工具
~\Anaconda3\lib\site packages\keras\utils\conv\u utils.py in
7从6.5移到进口范围
8作为np进口numpy
---->9从。。将后端导入为K
10
11
~\Anaconda3\lib\site packages\keras\backend\\uuuu init\uuuuuuuuuu.py in
---->1 from.load_后端导入epsilon
2 from.load\u后端导入集\u epsilon
3 from.load_后端导入floatx
4从加载\u后端导入集\u floatx
5 from.load_backend import cast_to_floatx
~\Anaconda3\lib\site packages\keras\backend\load\u backend.py in
88 elif_后端=='tensorflow':
89 sys.stderr.write('使用TensorFlow后端。\n')
--->90从tensorflow\u后端导入*
91其他:
92#尝试加载外部后端。
~\Anaconda3\lib\site packages\keras\backend\tensorflow\u backend.py in
3来自未来导入打印功能
4.
---->5导入tensorflow作为tf
6来自tensorflow.python.eager导入上下文
7从tensorflow.python.framework导入设备作为tfdev
中的~\AppData\Roaming\Python\Python38\site packages\tensorflow\\uuuu init\uuuuu.py
39导入系统为_sys
40
--->41从tensorflow.python.tools将模块_util作为_模块_util导入
42从tensorflow.python.util.lazy_加载程序将LazyLoader作为_LazyLoader导入
43
中的~\AppData\Roaming\Python\Python38\site packages\tensorflow\Python\\uuuuu init\uuuuuuu.py
37#go/tf通配符导入
38#pylint:disable=通配符导入,g-bad-import-order,g-import-not-at-top
--->39从tensorflow.python导入pywrap\u tensorflow作为_pywrap\u tensorflow
40
41来自tensorflow.python.eager导入上下文
中的~\AppData\Roaming\Python\Python38\site packages\tensorflow\Python\pywrap\u tensorflow.py
81因为一些常见的原因和解决方案。包括整个堆栈跟踪
请求帮助时,请在上面显示此错误消息。“%traceback.format_exc()
--->83.恐怖主义(味精)
84
85#pylint:enable=通配符导入,g-import-not-at-top,未使用的导入,行太长
ImportError:回溯(最近一次呼叫上次):
文件“C:\Users\T6518BB\AppData\Roaming\Python38\site packages\tensorflow\Python\pywrap\u tensorflow.py”,第64行,在
从tensorflow.python.\u pywrap\u tensorflow\u内部导入*
导入错误:导入_pywrap_tensorflow_internal时DLL加载失败:找不到指定的模块。
未能加载本机TensorFlow运行时。
看见https://www.tensorflow.org/install/errors
由于一些常见的原因和解决方案。包括整个堆栈跟踪
以上是请求帮助时的错误消息。