Search code examples
pythonmacostensorflowvirtualenvvirtualenvwrapper

How to install tensorflow with virtualenvwrapper on macOS-Sierra


I need to install TensorFlow on macOS-Sierra and I want to use virtualenvwrapper for that. To install TensorFlow one could follow the virtualenv installation walk-through provided by TensorFlow website. However, I want to do that with virtualenvwrapper that can be installed like so.

Could someone who has experience with this guide me through?


Solution

  • First I would install virtualenv and virtualenvwrapper:

    $pip install virtualenv
    $pip install virtualenvwrapper
    

    Then I would create a directory for my virtualenvs.

    $mkdir ~/.virtualenvs
    

    Then I would update my .bashrc file:

    #put these lines in your .bashrc file
    export WORKON_HOME=~/.virtualenvs
    source /usr/local/bin/virtualenvwrapper.sh
    

    Then source .bashrc:

    $source .bashrc
    

    Then create my virtual environment:

    $mkvirtualenv my-virtual-environment --system-site-packages target-directory
    

    To activate the virtual environment and install tensorflow:

    $workon my-virtual-environment
    (my-virtual-environment)$pip install --upgrade tensorflow
    

    I hope this helps. It's been a while since I've been a regular OSX user. If this doesn't work for you, keep this updated and I might be able to help more.