-
Notifications
You must be signed in to change notification settings - Fork 50
/
Copy pathinstall.sh
executable file
·69 lines (51 loc) · 2.07 KB
/
install.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/bash
is_raspberry_pi() {
if grep -q "Raspberry" /proc/cpuinfo || grep -q "BCM" /proc/cpuinfo; then
return 0 # Is raspberry Pi
else
return 1
fi
}
if is_raspberry_pi; then
echo "Raspberry Pi detected. Running Raspberry-specific script..."
echo "Update packages"
sudo apt-get update
echo "Installing libopencv-dev and libatlas-base-dev..."
sudo apt-get install -y libopencv-dev libatlas-base-dev
if ! command -v pip3 &> /dev/null; then
echo "pip3 not found. Installing pip3..."
sudo apt-get install -y python3-pip
fi
echo "Installing Pillow, numpy, scipy, matplotlib..."
pip3 install Pillow numpy scipy matplotlib
echo "Installing opencv-python and opencv-contrib-python..."
pip3 install opencv-python opencv-contrib-python
echo "Installation of dependencies completed for Raspberry Pi!"
else
echo "Non-Raspberry Pi system detected. Running standard script..."
echo "Updating package list..."
sudo apt-get update
echo "Installing libopencv-dev and libatlas-base-dev..."
sudo apt-get install -y libopencv-dev libatlas-base-dev
if ! command -v pip3 &> /dev/null; then
echo "pip3 not found. Installing pip3..."
sudo apt-get install -y python3-pip
fi
if ! command -v virtualenv &> /dev/null; then
echo "virtualenv not found. Installing virtualenv..."
pip3 install virtualenv
fi
echo "Creating a virtual environment..."
virtualenv venv
echo "Activating virtual environment..."
source venv/bin/activate
echo "Installing dependencies: Pillow, numpy, scipy, matplotlib, opencv-python, and opencv-contrib-python..."
pip install Pillow numpy scipy matplotlib opencv-python opencv-contrib-python
if [ -f requirements.txt ]; then
echo "Installing dependencies from requirements.txt..."
pip install -r requirements.txt
else
echo "requirements.txt not found. Skipping installation from requirements file."
fi
echo "Installation of dependencies completed for non-Raspberry Pi system!"
fi