【发布时间】:2021-07-23 18:55:35
【问题描述】:
!pip install Keras
import Keras
print(Keras.__version__)
import tensorflow as tf
print(tf.__version__)
运行上述代码后,我在尝试使用 nlp 和深度学习解决分类问题时遇到此错误,这就是我尝试安装 tensorflow 和 keras 的原因。但它不断向我抛出错误。
Requirement already satisfied: Keras in c:\users\hind\anaconda3\envs\toxic\lib\site-packages (2.4.3)
Requirement already satisfied: pyyaml in c:\users\hind\anaconda3\envs\toxic\lib\site-packages (from Keras) (5.4.1)
Requirement already satisfied: numpy>=1.9.1 in c:\users\hind\anaconda3\envs\toxic\lib\site-packages (from Keras) (1.19.5)
Requirement already satisfied: h5py in c:\users\hind\anaconda3\envs\toxic\lib\site-packages (from Keras) (3.1.0)
Requirement already satisfied: scipy>=0.14 in c:\users\hind\anaconda3\envs\toxic\lib\site-packages (from Keras) (1.6.2)
Requirement already satisfied: cached-property in c:\users\hind\anaconda3\envs\toxic\lib\site-packages (from h5py->Keras) (1.5.2)
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-6-0a6f7852735b> in <module>
1 get_ipython().system('pip install Keras')
----> 2 import Keras
3 print(Keras.__version__)
4 import tensorflow as tf
5 print(tf.__version__)
ModuleNotFoundError: No module named 'Keras'
【问题讨论】:
-
安装keras后有没有重启过内核?如果你在 jupyter notebook 中运行
-
@Kaveh 是的很多次
-
你试过了吗?
!pip3 install keras -
@Kaveh 问题不在于安装,因为要求已经满足,它不知何故没有导入 keras,是的,我也试过了
-
您的首字母大写。以小写形式使用。
import keras不是 Keras。