# Installation locale Windows - source unique: requirements.txt # Overrides Windows: psycopg2 (wheel), python-magic-bin, post-install (spacy, nltk) param( [switch]$SkipVenv, [switch]$SkipPsycopg ) $ErrorActionPreference = "Stop" Set-Location $PSScriptRoot if (-not $SkipVenv) { Write-Host "Activation du venv..." -ForegroundColor Cyan & .\venv\Scripts\Activate.ps1 } # 1. psycopg2 (Windows: wheel obligatoire pour Python 3.13) if (-not $SkipPsycopg) { Write-Host "`n1. psycopg2-binary (wheel Windows)..." -ForegroundColor Cyan pip install "psycopg2-binary>=2.9.9" --only-binary :all: if ($LASTEXITCODE -ne 0) { Write-Host " Pas de wheel. Utilisez: .\install_local.ps1 -SkipPsycopg (SQLite)" -ForegroundColor Red exit 1 } } # 2. Dépendances (filtrer psycopg2 si -SkipPsycopg) Write-Host "`n2. Installation de requirements.txt..." -ForegroundColor Cyan if ($SkipPsycopg) { $filtered = Get-Content requirements.txt | Where-Object { $_ -notmatch 'psycopg2' } $temp = [System.IO.Path]::GetTempFileName() $filtered | Set-Content $temp pip install -r $temp Remove-Item $temp } else { pip install -r requirements.txt } # 3. Override Windows: python-magic-bin (remplace python-magic qui nécessite libmagic système) Write-Host "`n3. python-magic-bin (Windows)..." -ForegroundColor Cyan pip uninstall python-magic -y 2>$null pip install python-magic-bin # 4. Post-install: spaCy + NLTK Write-Host "`n4. Modèle spaCy + NLTK..." -ForegroundColor Cyan python -m spacy download fr_core_news_sm python -c "import nltk; nltk.download('punkt'); nltk.download('punkt_tab')" Write-Host "`nTerminé. Lancez: .\run_local.ps1" -ForegroundColor Green