From 194a4d4377766c7a15cb935daa0cb35b2c8c3e6f Mon Sep 17 00:00:00 2001 From: xucheng Date: Thu, 30 Oct 2025 15:16:45 +0800 Subject: [PATCH] fix(run.sh): add check for python3-venv and provide instructions --- scripts/run.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/scripts/run.sh b/scripts/run.sh index ea59065..1f93f9f 100755 --- a/scripts/run.sh +++ b/scripts/run.sh @@ -2,6 +2,24 @@ # Exit immediately if a command exits with a non-zero status. set -e +# --- Prerequisite check for python3-venv --- +echo "Checking for Python venv module..." +if ! python3 -c 'import venv' &> /dev/null; then + echo "Python 'venv' module is missing. It's required to create a virtual environment for the backend." + + # Attempt to provide specific installation instructions + if command -v apt &> /dev/null; then + PY_VERSION_SHORT=$(python3 -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")') + echo "It seems you are on a Debian/Ubuntu-based system. Please install the venv module by running:" + echo "sudo apt update && sudo apt install python${PY_VERSION_SHORT}-venv" + else + echo "Please install the Python 'venv' module for your system." + fi + + exit 1 +fi +echo "Python venv module found." + # --- Backend Setup --- echo "Setting up backend..." cd backend