Skip to content

Instantly share code, notes, and snippets.

@pppoe
Created February 6, 2018 06:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pppoe/17039c6b4e8be591b8eb911f019b9919 to your computer and use it in GitHub Desktop.
Save pppoe/17039c6b4e8be591b8eb911f019b9919 to your computer and use it in GitHub Desktop.
A script to quickly install Tensorflow and setup a separated environment for dev
## put this into ~/Tensorflow/setup.sh settings are for Mac/CPU python3.5 by default, after installation, use $tf to load the env vars
#! /bin/bash
RootDir=$PWD/Tensorflow/
## Modify this line to install a different version of anaconda
AnacondaURL="https://repo.continuum.io/archive/Anaconda3-4.2.0-MacOSX-x86_64.sh"
## Modify this line to install a specific version of tensorflow
TFURL="https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.5.0-py3-none-any.whl"
## put in some extra dependencies here
CUSTOM_LD_LIBRARY_PATH=""
if [ "$PWD" != "$HOME" ]; then
echo "Abort, should run this from $HOME with ./Tensorflow/setup.sh"
exit
fi
tmpFile=`mktemp /tmp/XXXX.sh`
wget $AnacondaURL -O $tmpFile
bash $tmpFile -b -p $RootDir/anaconda3
cat > ~/.bashrc.conda << EOF
# added by Anaconda installer
export PATH="$RootDir/anaconda3/bin:\$PATH"
# setup LD_LIBRARY_PATH
export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH
# make a different prompt
PS1="(conda) \\e[32m\\u#\\h@\\@\\e[0m \\e[34m\\w\\e[0m\\n\\$"
EOF
cat >> ~/.bashrc << EOF
# added by Tensorflow
alias tf='source ~/.bashrc.conda'
EOF
source ~/.bashrc.conda
pip install $TFURL
which pip
pip3 install --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/protobuf-3.1.0-cp35-none-macosx_10_11_x86_64.whl
echo "Done."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment