forked from iree-org/iree-experimental
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup_venv.sh
executable file
·29 lines (24 loc) · 879 Bytes
/
setup_venv.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
#!/bin/bash
# Sets up a venv suitable for running samples.
# Recommend getting default 'python' to be python 3. For example on Debian:
# sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 1
# Or launch with python=/some/path
td="$(cd $(dirname $0) && pwd)"
venv_dir="$td/iree-samples.venv"
if [ -z "$python" ]; then
python="$(which python)"
fi
echo "Setting up venv dir: $venv_dir"
echo "Python: $python"
echo "Python version: $("$python" --version)"
function die() {
echo "Error executing command: $*"
exit 1
}
python -m venv "$venv_dir" || die "Could not create venv."
source "$venv_dir/bin/activate" || die "Could not activate venv"
# Upgrade pip.
python -m pip install --upgrade pip || die "Could not upgrade pip"
python -m pip install --upgrade -r "$td/requirements.txt"
echo "Activate venv with:"
echo " source $venv_dir/bin/activate"