My FeedDiscussionsHeadless CMS
New
Sign in
Log inSign up
Learn more about Hashnode Headless CMSHashnode Headless CMS
Collaborate seamlessly with Hashnode Headless CMS for Enterprise.
Upgrade ✨Learn more
Install Tensorflow with Virtuelenv and Visual Studio Code on Mac

Install Tensorflow with Virtuelenv and Visual Studio Code on Mac

Daniel Deutsch's photo
Daniel Deutsch
·Feb 10, 2018

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

python

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

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 - https://unsplash.com/photos/_NMJqIhNpno

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: