Skip to content

Instantly share code, notes, and snippets.

@Manuel4131
Last active December 15, 2020 03:44
Show Gist options
  • Save Manuel4131/aea5169ebcfb8ac9faba5188f8533186 to your computer and use it in GitHub Desktop.
Save Manuel4131/aea5169ebcfb8ac9faba5188f8533186 to your computer and use it in GitHub Desktop.
Install tensorflow for MacOS

Install it with the command.

pip3 install tensorflow

Reference the official installation here https://bit.ly/2Aje82T

Abstract

Install TensorFlow Assuming the prerequisite software is installed on your Mac, take the following steps: Install TensorFlow by invoking one of the following commands:

$ pip install tensorflow      # Python 2.7; CPU support
$ pip3 install tensorflow     # Python 3.n; CPU support

If the preceding command runs to completion, you should now validate your installation.

(Optional.) If Step 1 failed, install the latest version of TensorFlow by issuing a command of the following format:

$ sudo pip  install --upgrade **tfBinaryURL**   # Python 2.7
$ sudo pip3 install --upgrade **tfBinaryURL**   # Python 3.n 

where tfBinaryURL identifies the URL of the TensorFlow Python package. The appropriate value of tfBinaryURL depends on the operating system and Python version. Find the appropriate value for tfBinaryURL here. For example, if you are installing TensorFlow for macOS and Python 3.6 issue the following command:

$ sudo pip3 install --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.9.0-py3-none-any.whl

Python 2.7 https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.9.0-py2-none-any.whl

Python 3.4, 3.5, or 3.6 https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.9.0-py3-none-any.whl

After installing TensorFlow, validate your installation to confirm that the installation worked properly.

Invoke python from your shell as follows:

$ python

Enter the following short program inside the python interactive shell:
import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))
If the system outputs the following, then you are ready to begin writing TensorFlow programs:

Hello, TensorFlow!

To Uninstall TensorFlow

To uninstall TensorFlow, issue one of following commands: $ pip uninstall tensorflow $ pip3 uninstall tensorflow

@Nothing-01
Copy link

Thank you so much!!! You saved my day!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment