-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
61 lines (46 loc) · 1.63 KB
/
setup.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# setup.sh
# Script for installing and/or activating a virtualenv
#-----------------------------------------------------------------------------
# pre-setup helpers, don't touch
#-----------------------------------------------------------------------------
path_of_this_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
path_above_this_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../" && pwd )"
add_to_path()
{
export PATH=$1${PATH:+:${PATH}}
echo " Added $1 to your PATH."
}
add_to_ld_library_path()
{
export LD_LIBRARY_PATH=$1${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
echo " Added $1 to your LD_LIBRARY_PATH."
}
add_to_python_path()
{
export PYTHONPATH=$1${PYTHONPATH:+:${PYTHONPATH}}
echo " Added $1 to your PYTHONPATH."
}
#-----------------------------------------------------------------------------
# setup virtualenv
#-----------------------------------------------------------------------------
venv_name=".venv"
if [ -f ${venv_name}/bin/activate ]; then
source ${venv_name}/bin/activate
else
echo " Setting up virtualenv ${venv_name}"
python -m venv ${venv_name}
source ${venv_name}/bin/activate
pip install --upgrade pip
pip install -r requirements.txt
fi
#-----------------------------------------------------------------------------
# setup paths
#-----------------------------------------------------------------------------
add_to_path ${path_of_this_dir}/scripts
add_to_python_path ${path_of_this_dir}/python
## cuda
#if [ -d /usr/local/cuda ]; then
# add_to_ld_library_path /usr/local/cuda/lib64
# add_to_ld_library_path /usr/local/cuda/extras/CUPTI/lib64
#fi
echo " Done."