How to setup Tensorflow 2.0 on Mac OS in 2020

Devin Bandara
2 min readJul 2, 2020

Tensorflow is a great machine learning tool made by google. In this article I’ll be going over the quick and easy way to get set up. (Mostly so I can remember too).

As I get more acquainted with tensorflow I’ll be adding more details to this article as well as create some additional tutorials.

Download MiniConda

Use the 64 bit package version. Install it in the default location and open a new terminal window.

Install Jupyter

$ conda install jupyter

Now create a new file called tensorflow.yml and save it to your default user directory. The contents of this file are below.

name: tensorflow

dependencies:
- python=3.7
- pip>=19.0
- jupyter
- tensorflow=2.0
- scikit-learn
- scipy
- pandas
- pandas-datareader
- matplotlib
- pillow
- tqdm
- requests
- h5py
- pyyaml
- flask
- boto3
- pip:
- bayesian-optimization
- gym
- kaggle

Setup Tensorflow Environment

conda env create -v -f tensorflow.yml

This will take a little bit but when it’s finished you should be inside of tensorflow and we can test it like this:

python>>> import tensorflow as tf

Make sure you are inside tensorflow when you do this. Youll see (tensorflow) next to your username in the terminal.

If everything’s working right we can print the tensorflow version to see that we’re on version 2.0

print(tf.__version__)

Open Tensorflow on Jupyter Notebook

Next, install kernel for jupyter with this command:

python -m ipykernel install --user --name tensorflow --display-name "Python 3.7 (tensorflow)"

Then open jupyter notebook

jupyter notebook

When Jupyter Notebook opens, press new and click Python 3.7 (tensorflow)

From here you can use tensorflow, you’re in business!

If you need to get back into you’re tensorflow environment just run:

conda activate tensorflow

To exit, type:

conda deactivate

--

--

Devin Bandara

CEO & Founder @ Nirvana Labs - Enlightening Blockchain Infrastructure