我刚刚安装了keras并且是新的。我正在运行windows,通过pip安装tensorflow,python 3.6。试图运行“从keras.models导入顺序”并得到此错误。有什么想法吗?
Using TensorFlow backend.
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-23-490b9437d5d1> in <module>()
----> 1 from keras.models import Sequential
C:\Users\unknow\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
C:\Users\unknow\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
8 # Globally-importable utils.
C:\Users\unknow\Anaconda3\lib\site-packages\keras\utils\conv_utils.py in <module>()
1 from six.moves import range
2 import numpy as np
----> 3 from .. import backend as K
4
5
C:\Users\unknow\Anaconda3\lib\site-packages\keras\backend\__init__.py in <module>()
81 elif _BACKEND == 'tensorflow':
82 sys.stderr.write('Using TensorFlow backend.\n')
---> 83 from .tensorflow_backend import *
84 else:
85 raise ValueError('Unknown backend: ' + str(_BACKEND))
C:\Users\unknow\Anaconda3\lib\site-packages\keras\backend\tensorflow_backend.py in <module>()
----> 1 import tensorflow as tf
2 from tensorflow.python.training import moving_averages
3 from tensorflow.python.ops import tensor_array_ops
4 from tensorflow.python.ops import control_flow_ops
5 from tensorflow.python.ops import functional_ops
ModuleNotFoundError: No module named 'tensorflow'
答案 0 :(得分:0)
您尚未提及是否要安装CPU或GPU支持。我的答案是GPU,但如果你想安装CPU,大多数步骤都是一样的。(你可以跳过CPU的步骤3,步骤4和步骤5)
我的安装遇到了类似的问题。我使用了TensorFlow website上给出的安装步骤。当我在Ubuntu 16.04上安装TF时,它们运行良好。
我抓住了here给出的步骤,他们对我很好。我建议你尝试一次。