Spaces:
Sleeping
Sleeping
set -euo pipefail | |
# Simple installer: crea un venv local y instala las dependencias en él. | |
# Uso: ./scripts/install_deps.sh | |
PYTHON_CMD=${PYTHON_CMD:-python3} | |
VENV_DIR=${VENV_DIR:-venv} | |
echo "Usando Python: $($PYTHON_CMD --version 2>&1)" | |
if [ ! -d "$VENV_DIR" ]; then | |
echo "Creando entorno virtual en ./$VENV_DIR..." | |
$PYTHON_CMD -m venv "$VENV_DIR" | |
fi | |
# Activar el entorno | |
# shellcheck disable=SC1091 | |
source "$VENV_DIR/bin/activate" | |
echo "Entorno virtual activado: $(which python)" | |
echo "Actualizando pip, setuptools y wheel..." | |
python -m pip install --upgrade pip setuptools wheel | |
if [ -f requirements.txt ]; then | |
echo "Instalando dependencias desde requirements.txt..." | |
python -m pip install --no-cache-dir -r requirements.txt | |
echo "Dependencias instaladas correctamente." | |
else | |
echo "No se encontró requirements.txt; nada que instalar." | |
fi | |
echo "Listo. Para activar el entorno en nuevas shells: source $VENV_DIR/bin/activate" | |