-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.sh
47 lines (40 loc) · 1.19 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
#!/bin/bash
VENV_NAME=".venv"
if ! command -v python3 &>/dev/null; then
echo "Python 3 is not installed. Please install it and try again."
exit 1
fi
if [ -d "$VENV_NAME" ]; then
echo "Virtual environment '$VENV_NAME' already exists."
read -p "Do you want to recreate it? (y/n): " choice
case "$choice" in
y|Y )
echo "Removing existing virtual environment..."
rm -rf $VENV_NAME
echo "Creating new virtual environment..."
python3 -m venv $VENV_NAME
;;
n|N )
echo "Using existing virtual environment."
;;
* )
echo "Invalid choice. Exiting."
exit 1
;;
esac
else
echo "Creating new virtual environment..."
python3 -m venv $VENV_NAME
fi
source $VENV_NAME/bin/activate
pip install --upgrade pip
if [ -f "requirements.txt" ]; then
pip install -r requirements.txt
echo "Requirements installed successfully."
else
echo "requirements.txt not found. No packages were installed."
fi
echo "Setup complete."
echo "Activating virtual environment..."
source $VENV_NAME/bin/activate
echo "Virtual environment activated. Run 'deactivate' to exit."