-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.sh
36 lines (31 loc) · 975 Bytes
/
run.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
#!/bin/bash
# Change to the script's directory
cd "$(dirname "$0")"
# List of required Python libraries
libs=("flask" "psutil" "humanize" "py-cpuinfo" "gputil")
libspre=("flask" "psutil" "humanize" "cpuinfo" "gputil")
# Check if Python is installed
if ! command -v python &> /dev/null; then
echo "Python is not installed. Please install Python first."
exit 1
fi
# Check and install required Python libraries
for lib in "${libspre[@]}"; do
python -c "import $lib" 2>/dev/null
if [ $? -ne 0 ]; then
echo "Installing $lib..."
pip install "$lib"
if [ $? -ne 0 ]; then
echo "Failed to install $lib. Please check your internet connection and try again."
exit 1
fi
else
echo "$lib is already installed. Skipping..."
fi
done
# Run the server
echo "==========================================="
echo "running server..."
echo "==========================================="
python app.py
exit 0