Home » Python » Where is the folder for Installing tensorflow with pip, Mac OSX?

Where is the folder for Installing tensorflow with pip, Mac OSX?

Posted by: admin April 3, 2018 Leave a comment


just installed tensorflow using pip with the command:

$ pip install tensorflow

On the “Getting Started” for Tensorflow they have an example for convolutional neural networks

$ python tensorflow/models/image/mnist/convolutional.py

Where is that directory located when installing with pip?


Installing with pip, installs the packages to the directory “site-packages”.

The following code shows the location of tensorflow as well as where pip installs the packages:

$ pip show tensorflow

Which return:

Metadata-Version: 2.0
Name: tensorflow
Version: 0.5.0
Summary: TensorFlow helps the tensors flow
Home-page: http://tensorflow.com/
Author: Google Inc.
Author-email: [email protected]
License: Apache 2.0
Location: /usr/local/lib/python2.7/site-packages
Requires: six, numpy

here Location: shows where the package is installed with

$ cd /usr/local/lib/python2.7/site-packages/tensorflow


It depends on where is $TENSORFLOW environment variable is set. Lets help it setup.

First check,
if it return blank, you need to setup to access from any directory from your console.

In case you have python from anaconda library/environment (let say you have

Usually installed location:

In case of Python2.x or Python3.x, x = is subversion like 2.7 or 3.5
Usually installed location:

Now you have identified python version.
Use it as onetime path in bash or profile.

$ vi ~/.bashrc

add this line in the bottom of the basrc file.

$ export $TENSORFLOW="~/anaconda2/lib/python2.7/site-packages/tensorflow:$PATH"

check again in a new terminal


now you can use

$ python tensorflow/models/image/mnist/convolutional.py

directly by

$ python -m tensorflow.models.image.mnist.convolutional.py

Now your program as per description in TensorFlow tutorial will search these path with period (.) instead of “/” with -m argument.