!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'
试试这个: !pip安装keras或pip3安装keras
代码段中的包名称不正确
对于此问题,以下是最常见的错误及其解决方案:
pip
,python3使用pip3
,但您安装的软件包版本错误。尝试使用!pip3 install keras
import keras
时会出现错误。改用from tensorflow import keras
李>相关问题 更多 >
编程相关推荐