fix(6): update standalone start_server.sh to use Python virtual environment

- Create .venv automatically if missing
- Activate virtual environment before pip install
- Fixes PEP 668 externally-managed-environment error on Python 3.12
- Virtual environment isolated from system Python packages
This commit is contained in:
2026-04-22 18:29:15 +03:00
parent fc149184e9
commit a2fd9b1ce6

View File

@@ -104,6 +104,16 @@ if [[ ! -f "requirements.txt" ]]; then
log_error "backend/requirements.txt not found"
fi
# Create and use Python virtual environment
VENV_DIR="../.venv"
if [[ ! -d "$VENV_DIR" ]]; then
log_info " Creating Python virtual environment..."
python3 -m venv "$VENV_DIR" || log_error "Failed to create virtual environment"
fi
# Activate virtual environment
source "$VENV_DIR/bin/activate"
# Install dependencies if needed
if ! python3 -c "import fastapi" &> /dev/null; then
log_info " Installing Python dependencies..."