How to Install TensorFlow

TensorFlow is a tool to build machine learning models. Learn about it here.

Before we install TensorFlow, we have to install a programming language to use to write code in TensorFlow. TensorFlow works with multiple languages including JavaScript and Python. In this tutorial, we’re going to be downloading Python. How to install Python.

We will be installing TensorFlow with pip so make sure you have pip installed on your computer. You can check if you have pip installed by typing this line in Terminal:

pip3 --version

It should install by itself when you install Python so you shouldn’t have to worry about that.

Now we will install TensorFlow with the command below. It will install in your $HOME directory. If you don’t want this, find a tutorial that shows you how to use a virtual environment. I personally haven’t had luck with this strategy.

pip3 install --user --upgrade tensorflow 

Verify the install with this line:

python3 -c "import tensorflow as tf; tf.enable_eager_execution(); print(tf.reduce_sum(tf.random_normal([1000, 1000])))"

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s