-
Notifications
You must be signed in to change notification settings - Fork 70
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·52 lines (43 loc) · 1.65 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·52 lines (43 loc) · 1.65 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
#!/bin/bash
# ------------------------------------------------------------------------------
# rpi-object-detection: install script
#
# Creates a Python virtual environment in ./venv and installs the dependencies
# listed in requirements.txt.
#
# On Raspberry Pi, the venv is created with --system-site-packages so that
# libcamera and picamera2 (installed in the system Python by Raspberry Pi OS)
# remain accessible from inside the venv.
# ------------------------------------------------------------------------------
set -e
echo "Welcome to Raspberry Pi Real-Time Object Detection and Tracking"
echo "For more information: https://github.com/automaticdai/rpi-object-detection"
is_raspberry_pi() {
grep -qE "Raspberry|BCM" /proc/cpuinfo
}
echo "Updating package list..."
sudo apt-get update
echo "Installing system dependencies (libopencv-dev, libatlas-base-dev, python3-venv, python3-pip)..."
sudo apt-get install -y libopencv-dev libatlas-base-dev python3-venv python3-pip
if is_raspberry_pi; then
echo "Raspberry Pi detected."
VENV_ARGS="--system-site-packages"
else
echo "Non-Raspberry Pi system detected."
VENV_ARGS=""
fi
if [ ! -d venv ]; then
echo "Creating virtual environment in ./venv ..."
python3 -m venv ${VENV_ARGS} venv
else
echo "Virtual environment ./venv already exists — reusing it."
fi
echo "Upgrading pip tooling..."
./venv/bin/pip install --upgrade pip setuptools wheel
echo "Installing Python dependencies from requirements.txt ..."
./venv/bin/pip install -r requirements.txt
echo ""
echo "Installation complete."
echo ""
echo "To activate the virtual environment in your shell, run:"
echo " source venv/bin/activate"