-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup_env.sh
45 lines (32 loc) · 963 Bytes
/
setup_env.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/bash
#
# Set up the virtual environment to be used for work
# on tfkoans (tensorflow koans).
#
ENV_NAME="tfkoans-env"
command_exists () {
type "$1" &> /dev/null ;
}
if [[ $- != *i* ]]; then
echo Please run this script like so: ". setup_env.sh"
echo That allows the script to put you into the virtual environment.
exit 1
fi
if [ ! -d $ENV_NAME ]; then
if ! command_exists virtualenv; then
echo "Please install virtualenv: pip install virtualenv"
echo "sudo may be needed"
exit 1
fi
echo
echo Setting up environment with virtualenv.
echo =======================================
virtualenv -p python3 $ENV_NAME
echo
source $ENV_NAME/bin/activate
pip install jupyter ipython tensorflow numpy scipy sklearn jupyterlab
ipython kernel install --user --name=$ENV_NAME
else
echo Looks like your virtual environment already exists.
source $ENV_NAME/bin/activate
fi