From dd5f787af7cd6d3b3f4d79b90fd2660b6d9460a1 Mon Sep 17 00:00:00 2001 From: webfarben Date: Mon, 23 Feb 2026 12:46:04 +0100 Subject: [PATCH] =?UTF-8?q?F=C3=BCge=20python3-venv=20Pr=C3=BCfung=20und?= =?UTF-8?q?=20Installation=20zu=20install.sh=20hinzu?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Prüft ob venv-Modul verfügbar ist bevor Virtual Environment erstellt wird - Installiert automatisch das passende python3-venv Paket auf Debian/Ubuntu - Ermittelt Python-Version um korrektes Paket zu installieren (z.B. python3.12-venv) - Behebt Fehler beim Ausführen auf Systemen ohne vorinstalliertes venv-Modul --- install.sh | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/install.sh b/install.sh index a741a65..acc5dee 100755 --- a/install.sh +++ b/install.sh @@ -53,6 +53,42 @@ fi PYTHON_VERSION=$(python3 --version) print_success "Python gefunden: $PYTHON_VERSION" +# Prüfe und installiere python3-venv wenn nötig +print_step "Prüfe venv-Installation..." +if ! python3 -c "import venv" 2>/dev/null; then + print_warning "venv ist nicht installiert. Installation wird versucht..." + + # Erkenne Distribution + if [ -f /etc/debian_version ]; then + echo "Debian/Ubuntu erkannt. Installiere python3-venv..." + # Ermittle Python-Version für das richtige Paket + PYTHON_VERSION_NUM=$(python3 -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")') + VENV_PACKAGE="python${PYTHON_VERSION_NUM}-venv" + + if command -v sudo &> /dev/null; then + sudo apt-get update && sudo apt-get install -y "$VENV_PACKAGE" + else + print_error "sudo nicht verfügbar. Bitte installieren Sie $VENV_PACKAGE manuell:" + echo " apt install $VENV_PACKAGE" + exit 1 + fi + elif [ -f /etc/fedora-release ]; then + echo "Fedora erkannt. Python venv sollte bereits enthalten sein..." + print_error "Falls venv fehlt, installieren Sie bitte python3-devel" + exit 1 + elif [ -f /etc/arch-release ]; then + echo "Arch Linux erkannt. Python venv sollte bereits enthalten sein..." + print_error "Falls venv fehlt, installieren Sie bitte python erneut" + exit 1 + else + print_error "Distribution nicht erkannt. Bitte installieren Sie python3-venv manuell." + exit 1 + fi + print_success "venv installiert" +else + print_success "venv ist bereits installiert" +fi + # Prüfe und installiere Tkinter wenn nötig print_step "Prüfe Tkinter-Installation..." if ! python3 -c "import tkinter" 2>/dev/null; then