python-tensorflowHow do I install TensorFlow in a Python Jupyter Notebook?
-
Install TensorFlow in your environment:
pip install tensorflow -
Import TensorFlow in your Jupyter Notebook:
import tensorflow as tf -
Check the version of TensorFlow installed:
print(tf.__version__)Output:
2.2.0 -
Create a constant in TensorFlow:
hello = tf.constant('Hello, TensorFlow!') -
Run the constant in a session:
sess = tf.Session() print(sess.run(hello))Output:
Hello, TensorFlow! -
Close the session to release resources:
sess.close() -
You have now successfully installed and used TensorFlow in your Python Jupyter Notebook!
Helpful links
More of Python Tensorflow
- How can I use Tensorflow 1.x with Python 3.8?
- How can I disable warnings in Python TensorFlow?
- How can I use XGBoost, Python, and Tensorflow together for software development?
- How do I resolve the "no module named 'tensorflow.python.keras.preprocessing'" error?
- How can I use Python and TensorFlow to detect images?
- How do I use Python and TensorFlow to fit a model?
- How do I convert an unrecognized type class 'tensorflow.python.framework.ops.eagertensor' to JSON?
- How can I enable GPU support for TensorFlow in Python?
- How do I disable the GPU in Python Tensorflow?
- How can I install and use TensorFlow on a Windows machine using Python?
See more codes...