简体   繁体   中英

Have I successfully installed TensorFlow and Keras?

On Jupyter Notebook, I have the following code:

!pip install keras
!pip install tensorflow
import tensorflow as tf

Under it, it spits out this after I've ran it.

 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)

There's more lines but does this mean keras and tensorflow have been successfully installed and I can start using the packages?

Yes, in fact it means that tensorflow and keras had already been installed ("Requirement already satisfied").

You can verify this by running

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.

You can also run the following code snippet in your jupyter notebook to check this:

import tensorflow as tf
tf.version.VERSION

import keras
keras.__version__

However, As the output states:

Requirement already satisfied: tensorflow 
Requirement already satisfied: keras

Both packages have been installed, and you can start using them!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM