0

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?

user20112015
  • 307
  • 1
  • 3
  • 9

1 Answers1

2

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.

rug3y
  • 104
  • 4
  • Thank you! This is really helpful. However when I do '$pip install virtualenv' I get 'pip: command not found'. However I can do pip3 or pip2 (I installed python 3 myself). What do you recommend I do? I don't want to mess up anything with the preinstalled version of python on my mac. – user20112015 Aug 12 '17 at 10:46
  • I installed pip with 'sudo easy_install pip'. Then when I do 'source /usr/local/bin/virtualenvwrapper.sh' I get 'No module named virtualenvwrapper virtualenvwrapper.sh: There was a problem running the initialization hooks. If Python could not import the module virtualenvwrapper.hook_loader, check that virtualenvwrapper has been installed for VIRTUALENVWRAPPER_PYTHON=/usr/bin/python and that PATH is set properly.' – user20112015 Aug 12 '17 at 11:16
  • It looks like virtualenvwrapper isn't installed to the same path that I put in my directions. You'll have to find the path that it has been installed to, and substitute that path in your .bashrc. – rug3y Aug 12 '17 at 15:35
  • How can I find out where it gets installed? I do `which virtualenv` which yields `/usr/local/bin/virtualenv`. But `which virtualenvwrapper` does not yield anything. However, I can see that 'virtualenvwrapper.sh` exists in `/usr/local/bin/`. – user20112015 Aug 12 '17 at 17:30