-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.sh
32 lines (28 loc) · 985 Bytes
/
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
check_error() {
if [ $? -ne 0 ]; then
echo "Error: $1"
exit 1
fi
}
# Step 1: Set up virtual environment
echo "Setting up virtual environment..."
python3 -m venv venv # Ganti dengan 'python3' atau 'python' sesuai dengan kebutuhan
check_error "Failed to create virtual environment."
# Step 2: Activate virtual environment
echo "Activating virtual environment..."
# Gunakan command untuk mengaktifkan environment sesuai dengan sistem yang digunakan
if [ -f "venv/Scripts/activate" ]; then
source venv/Scripts/activate
elif [ -f "venv/bin/activate" ]; then
source venv/bin/activate
else
echo "Error: Unable to find virtual environment activation script."
exit 1
fi
check_error "Failed to activate virtual environment."
# Step 3: Install dependencies
echo "Installing dependencies..."
pip install -r requirements.txt
check_error "Failed to install dependencies."
echo "Setup completed successfully."
exit 0 # Hapus exit 1 yang tidak diperlukan