!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'发布于 2021-07-23 20:22:26
对于这个问题,以下是最常见的错误及其解决办法:
pip,python3使用pip3,但是您安装的软件包版本错误。尝试使用!pip3 install keraskeras和tensorflow,而不是Keras或tensorflow,您有tensorflow和keras,取决于版本,可能是一些冲突,在执行import keras时会出现错误。使用替代from tensorflow import keras.发布于 2021-07-23 19:10:41
尝试如下:!pip安装keras或pip3安装keras
import keras
print(keras.__version__)
import tensorflow as tf
print(tf.__version__)在您的代码段中,包名不正确。
https://stackoverflow.com/questions/68503938
复制相似问题