我尝试在python中导入以下代码,但发生了错误消息。 我使用的是Python 3.6.4,Windows
from keras.models import Sequential
错误讯息:
Using TensorFlow backend.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\Lawrence\AppData\Local\Programs\Python\Python36-32\lib\site-packages\keras\__init__.py", line 3, in <module>
from . import utils
File "C:\Users\Lawrence\AppData\Local\Programs\Python\Python36-32\lib\site-packages\keras\utils\__init__.py", line 6, in <module>
from . import conv_utils
File "C:\Users\Lawrence\AppData\Local\Programs\Python\Python36-32\lib\site-packages\keras\utils\conv_utils.py", line 9, in <module>
from .. import backend as K
File "C:\Users\Lawrence\AppData\Local\Programs\Python\Python36-32\lib\site-packages\keras\backend\__init__.py", line 84, in <module>
from .tensorflow_backend import *
File "C:\Users\Lawrence\AppData\Local\Programs\Python\Python36-32\lib\site-packages\keras\backend\tensorflow_backend.py", line 5, in <module>
import tensorflow as tf
ModuleNotFoundError: No module named 'tensorflow'
实际上我确实在CMD中安装了以下代码:
pip install keras
pip install Sequential
有人能告诉我还应该安装什么或者我该怎么办?谢谢。
答案 0 :(得分:0)
Keras有一个默认的Tensorflow后端。所以首先使用命令安装tensorflow,
$ cat a.awk
# Create an index from the first two columns
{ k = $1 FS $2 }
# Read file2 values (first on the command line) into an array
NR == FNR { a[k] = $4; next }
# Read file1, retrieving and printing the values from file2 where available
# After printing, delete the element we've already used
{ print $1, $2, k in a ? a[k] : "-"; delete a[k] }
# Print any left over elements with their values
END { for (i in a) { print i, a[i] } }
您也可以在当前阶段执行此操作。它应该工作正常。