User Tools

Site Tools


install.py

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
install.py [2025/12/20 15:05] 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>
 import sys import sys
-import time 
 import subprocess import subprocess
  
Line 9: Line 10:
             command.insert(0, "sudo")             command.insert(0, "sudo")
         subprocess.check_call(command)         subprocess.check_call(command)
-        print(f {' '.join(command)}\n")+        print(" ".join(command))
     except subprocess.CalledProcessError:     except subprocess.CalledProcessError:
-        print(f {' '.join(command)}\n")+        print("FAILED:", " ".join(command))
  
 print("\n=== Updating system packages ===\n") print("\n=== Updating system packages ===\n")
 run_command(["apt", "update"], use_sudo=True) run_command(["apt", "update"], use_sudo=True)
-time.sleep(1) 
  
 # --- System dependencies --- # --- System dependencies ---
Line 21: Line 21:
     "python3-pip",     "python3-pip",
     "python3-venv",     "python3-venv",
 +    "python3-dev",
 +
     "python3-numpy",     "python3-numpy",
     "python3-pandas",     "python3-pandas",
Line 31: Line 33:
     "python3-requests",     "python3-requests",
     "python3-chardet",     "python3-chardet",
 +
     "libsdl2-image-2.0-0",     "libsdl2-image-2.0-0",
     "libhdf5-dev",     "libhdf5-dev",
Line 37: Line 40:
     "libopenjp2-7",     "libopenjp2-7",
     "libopenjp2-7-dev",     "libopenjp2-7-dev",
-    "net-tools"+ 
 +    "net-tools", 
 +    "wireless-tools", 
 +    "iw", 
 +    "rfkill"
 ] ]
  
 for pkg in system_packages: for pkg in system_packages:
-    print(f"Installing APT package: {pkg}") 
     run_command(["apt", "install", "-y", pkg], use_sudo=True)     run_command(["apt", "install", "-y", pkg], use_sudo=True)
-    time.sleep(1) 
  
-# --- Some packages only on PyPI ---+# --- Python packages (pip) ---
 python_pip_packages = [ python_pip_packages = [
     "depthai",     "depthai",
Line 53: Line 58:
 ] ]
  
-print("\n=== Installing extra Python packages with pip ===\n")+print("\n=== Installing Python packages with pip ===\n")
 for pkg in python_pip_packages: for pkg in python_pip_packages:
-    run_command([sys.executable, "-m", "pip", "install", "--break-system-packages", pkg]) +    run_command( 
-    time.sleep(2)+        [sys.executable, "-m", "pip", "install", "--break-system-packages", pkg] 
 +    )
  
 # --- Permissions --- # --- Permissions ---
-target_folder = "/home/pi/Desktop/smart_weeder_server"+target_folder = "/home/pi/Desktop/WEEDER_PREMIUM_MULTI"
 print(f"\nSetting chmod 777 to: {target_folder}") print(f"\nSetting chmod 777 to: {target_folder}")
 run_command(["chmod", "-R", "777", target_folder], use_sudo=True) run_command(["chmod", "-R", "777", target_folder], use_sudo=True)
Line 66: Line 72:
 print("\nCreating USB rule for DepthAI...") print("\nCreating USB rule for DepthAI...")
 depthai_rule = 'SUBSYSTEM=="usb", ATTRS{idVendor}=="03e7", MODE="0666"' depthai_rule = 'SUBSYSTEM=="usb", ATTRS{idVendor}=="03e7", MODE="0666"'
-run_command(["bash", "-c", f"echo '{depthai_rule}'sudo tee /etc/udev/rules.d/80-movidius.rules"])+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", "control", "--reload-rules"], use_sudo=True)
 run_command(["udevadm", "trigger"], use_sudo=True) run_command(["udevadm", "trigger"], use_sudo=True)
  
-print("\n=== Installation complete===\n")+print("\n=== Installation complete ===\n")
  
 </code> </code>
install.py.1766243108.txt.gz · Last modified: by 46.109.187.144 · Currently locked by: 216.73.216.181