Skip to content

Latest commit

 

History

History
79 lines (51 loc) · 2.02 KB

File metadata and controls

79 lines (51 loc) · 2.02 KB

Tutorial: running TensorFlow on macOS laptop

Python 3.6.7

Currently, TensorFlow supports only Python 3.6, not 3.7 (see GitHub issue). Download Python 3.6.7 and install (requires admin rights).

No GPU on macOS

This page on common installation problems mentions

There is no GPU support for macOS.

Install TensorFlow

These instructions guide the installation of TensorFlow.

Verify your Python installation with

python3 --version
pip3 --version

Install virtualenv for current user

export PYTHONUSERBASE=$HOME
pip3 install virtualenv

Create a new virtual environment

virtualenv --system-site-packages -p python3 ./venv

Pitfall #1

If this last command fails, follow this suggestion:

python3 -m virtualenv ./venv

Pitfall #2

If you already have Python 3.7 installed, and get this error:

$ virtualenv --system-site-packages -p python3 ./venv
-bash: /usr/local/bin/virtualenv: /usr/local/opt/python/bin/python3.7: bad interpreter: No such file or directory

install virtualenv again with pip, uninstall it, and install it again with pip3 (as in this SuperUser thread).

After virtual environment installation

Activate the environment with

source ./venv/bin/activate

Upgrade pip in this environment

pip3 install --upgrade pip

Install tensorflow in this environment:

pip3 install --upgrade tensorflow

Verify that TensorFlow is working by running:

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