Füge python3-venv Prüfung und Installation zu install.sh hinzu
- 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
This commit is contained in:
36
install.sh
36
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
|
||||
|
||||
Reference in New Issue
Block a user