-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·75 lines (59 loc) · 1.87 KB
/
setup.sh
File metadata and controls
executable file
·75 lines (59 loc) · 1.87 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/bin/bash
set -e # Exit immediately if a command exits with a non-zero status
# Colors for output
GREEN="\e[32m"
YELLOW="\e[33m"
RED="\e[31m"
RESET="\e[0m"
# Function to print status messages
echo_status() {
echo -e "${GREEN}[✔] $1${RESET}"
}
echo_warning() {
echo -e "${YELLOW}[!] $1${RESET}"
}
echo_error() {
echo -e "${RED}[✘] $1${RESET}" >&2
}
# Install Oh My Zsh if not already installed
echo_status "Checking for Oh My Zsh..."
if [ ! -d "$HOME/.oh-my-zsh" ]; then
echo_status "Installing Oh My Zsh..."
sudo apt update && sudo apt install -y zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" || {
echo_error "Failed to install Oh My Zsh."
exit 1
}
else
echo_warning "Oh My Zsh is already installed. Skipping..."
fi
# Create virtual environment
echo_status "Creating Python virtual environment..."
python3 -m venv venv --system-site-packages || {
echo_error "Failed to create virtual environment."
exit 1
}
echo_status "Virtual environment created successfully."
# Activate the virtual environment
echo_status "Activating virtual environment..."
source venv/bin/activate || {
echo_error "Failed to activate virtual environment."
exit 1
}
echo_status "Virtual environment activated."
# Upgrade pip
echo_status "Upgrading pip..."
pip install --upgrade pip || {
echo_error "Failed to upgrade pip."
exit 1
}
echo_status "Pip upgraded successfully."
# Install required dependencies
echo_status "Installing dependencies: requirements.txt"
venv/bin/pip install -r requirements.txt || {
echo_error "Failed to install dependencies."
exit 1
}
pip install --no-cache-dir "git+https://github.com/Tencent/ncnn.git"
echo_status "All dependencies installed successfully."
echo -e "${GREEN}Setup complete. Use 'source venv/bin/activate' to activate the environment.${RESET}"