User Tools

Site Tools


install.py

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
install.py [2025/12/20 15:03] – created 46.109.187.144install.py [2025/12/20 15:46] (current) 46.109.187.144
Line 1: Line 1:
 +**Palaist: python3 install.py**
 +
 <code> <code>
-TER+import sys 
 +import subprocess 
 + 
 +def run_command(command, use_sudo=False): 
 +    try: 
 +        if use_sudo: 
 +            command.insert(0, "sudo"
 +        subprocess.check_call(command) 
 +        print(" ".join(command)) 
 +    except subprocess.CalledProcessError: 
 +        print("FAILED:", " ".join(command)) 
 + 
 +print("\n=== Updating system packages ===\n"
 +run_command(["apt", "update"], use_sudo=True) 
 + 
 +# --- System dependencies --- 
 +system_packages = [ 
 +    "python3-pip", 
 +    "python3-venv", 
 +    "python3-dev", 
 + 
 +    "python3-numpy", 
 +    "python3-pandas", 
 +    "python3-opencv", 
 +    "python3-flask", 
 +    "python3-flask-socketio", 
 +    "python3-paramiko", 
 +    "python3-pyqt5", 
 +    "python3-urllib3", 
 +    "python3-requests", 
 +    "python3-chardet", 
 + 
 +    "libsdl2-image-2.0-0", 
 +    "libhdf5-dev", 
 +    "libatlas-base-dev", 
 +    "libusb-1.0-0-dev", 
 +    "libopenjp2-7", 
 +    "libopenjp2-7-dev", 
 + 
 +    "net-tools", 
 +    "wireless-tools", 
 +    "iw", 
 +    "rfkill" 
 +
 + 
 +for pkg in system_packages: 
 +    run_command(["apt", "install", "-y", pkg], use_sudo=True) 
 + 
 +# --- Python packages (pip) --- 
 +python_pip_packages = [ 
 +    "depthai", 
 +    "depthai-sdk", 
 +    "Kivy", 
 +    "pynmea2" 
 +
 + 
 +print("\n=== Installing Python packages with pip ===\n"
 +for pkg in python_pip_packages: 
 +    run_command( 
 +        [sys.executable, "-m", "pip", "install", "--break-system-packages", pkg] 
 +    ) 
 + 
 +# --- Permissions --- 
 +target_folder = "/home/pi/Desktop/WEEDER_PREMIUM_MULTI" 
 +print(f"\nSetting chmod 777 to: {target_folder}"
 +run_command(["chmod", "-R", "777", target_folder], use_sudo=True) 
 + 
 +# --- UDEV rule for DepthAI camera --- 
 +print("\nCreating USB rule for DepthAI..."
 +depthai_rule = 'SUBSYSTEM=="usb", ATTRS{idVendor}=="03e7", MODE="0666"' 
 +run_command( 
 +    ["bash", "-c", f"echo '{depthai_rule}' | tee /etc/udev/rules.d/80-movidius.rules"], 
 +    use_sudo=True 
 +
 +run_command(["udevadm", "control", "--reload-rules"], use_sudo=True) 
 +run_command(["udevadm", "trigger"], use_sudo=True) 
 + 
 +print("\n=== Installation complete ===\n"
 </code> </code>
install.py.1766243029.txt.gz · Last modified: by 46.109.187.144 · Currently locked by: 216.73.216.181