-
-
Notifications
You must be signed in to change notification settings - Fork 173
/
Copy pathsetup_env.sh
executable file
·45 lines (40 loc) · 1.09 KB
/
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
#!/usr/bin/env bash
dirpath=$(dirname "$(readlink -f "$0")")
# Check if git is installed
if ! command -v git &> /dev/null; then
echo
echo "No git executable found in PATH!"
echo
read -p "Press any key to continue..."
exit 1
fi
# Check if the virtual environment exists
if [ ! -d "$dirpath/env" ]; then
echo
echo "Creating the env folder..."
python3 -m venv "$dirpath/env"
if [ $? -ne 0 ]; then
echo
echo "No python executable found in PATH or failed to create virtual environment!"
echo
read -p "Press any key to continue..."
exit 1
fi
fi
# Activate the virtual environment and install requirements
echo
echo "Installing requirements.txt..."
"$dirpath/env/bin/python" -m pip install -U pip
"$dirpath/env/bin/pip" install wheel
"$dirpath/env/bin/pip" install -r "$dirpath/requirements.txt"
if [ $? -ne 0 ]; then
echo
echo "Failed to install requirements."
echo
read -p "Press any key to continue..."
exit 1
fi
echo
echo "Environment setup completed successfully."
echo
read -p "Press any key to continue..."