[英]Can import TensorFlow and Keras in Jupyter, even though I have them installed?
[英]Have I successfully installed TensorFlow and Keras?
在 Jupyter Notebook 上,我有以下代码:
!pip install keras
!pip install tensorflow
import tensorflow as tf
在它下面,我运行它后它会吐出这个。
Requirement already satisfied: keras in c:\users\nollb\anaconda3\lib\site-packages (2.4.3)
Requirement already satisfied: numpy>=1.9.1 in c:\users\nollb\anaconda3\lib\site-packages (from keras) (1.18.5)
Requirement already satisfied: pyyaml in c:\users\nollb\anaconda3\lib\site-packages (from keras) (5.3.1)
Requirement already satisfied: scipy>=0.14 in c:\users\nollb\anaconda3\lib\site-packages (from keras) (1.5.2)
Requirement already satisfied: h5py in c:\users\nollb\anaconda3\lib\site-packages (from keras) (2.10.0)
Requirement already satisfied: six in c:\users\nollb\anaconda3\lib\site-packages (from h5py->keras) (1.15.0)
Requirement already satisfied: tensorflow in c:\users\nollb\anaconda3\lib\site-packages (2.3.1)
Requirement already satisfied: six>=1.12.0 in c:\users\nollb\anaconda3\lib\site-packages (from tensorflow) (1.15.0)
还有更多行,但这是否意味着 keras 和 tensorflow 已成功安装,我可以开始使用这些软件包了吗?
是的,实际上这意味着tensorflow
和keras
已经安装(“要求已经满足”)。
您可以通过运行来验证这一点
python -c 'import tensorflow as tf; print(tf.__version__)' # for Python 2
python3 -c 'import tensorflow as tf; print(tf.__version__)' # for Python 3
Note that nowadays it is recommended to use tensorflow.keras
which is integrated into tensorflow instead of the standalone keras
package.
您还可以在 jupyter notebook 中运行以下代码片段来检查:
import tensorflow as tf
tf.version.VERSION
import keras
keras.__version__
但是,正如 output 所述:
Requirement already satisfied: tensorflow
Requirement already satisfied: keras
两个包都已经安装好了,可以开始使用了!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.