Install Tensorflow with Virtuelenv and Visual Studio Code on Mac

The more detailled guide from Tensorflow's website broken down. I will use the VirtuelEnv, Python 2.7 and zsh. Enjoy!

Table of Contents

Installing Tensorflow

Shell commands

sudo easy_install pip

pip install --upgrade virtualenv 

virtualenv --system-site-packages <targetDirectory>

cd <targetDirectory>

source ./bin/activate 

easy_install -U pip

pip install --upgrade tensorflow

Test if the installation has worked


# inside the python shell
import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()

This should show 'Hello, TensorFlow!' in the console.

If not, check out the official homepage for a solution.

Set up Visual Studio Code

Install the Visual Studio Python Extension

Set up the virtual environment

For more details, see the official site.

Tip: To see your path use 'echo $VIRTUAL_ENV'

When the setup settings are not working, simply activate the virtualenv in the terminal with

source ./bin/activate

See a Github repository for a test.

Photo by Stephen Leonardi on Unsplash -

Thanks for reading my article! Feel free to leave any feedback!

Daniel is a LL.M. student in business law, working as a software engineer and organizer of tech related events in Vienna. His current personal learning efforts focus on machine learning. Connect on:

Learn Something New Everyday,
Connect With The Best Developers!

Sign Up Now!

& 500k+ others use Hashnode actively.

No Comments Yet