-
-
Notifications
You must be signed in to change notification settings - Fork 501
Expand file tree
/
Copy pathsetup_venv.sh
More file actions
executable file
·35 lines (27 loc) · 756 Bytes
/
setup_venv.sh
File metadata and controls
executable file
·35 lines (27 loc) · 756 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env bash
# Set up a virtual environment for PyGAD.
#
# Usage:
# ./setup_venv.sh
# PYTHON=python3.12 ./setup_venv.sh
set -euo pipefail
PYTHON="${PYTHON:-python3}"
VENV_DIR=".venv"
cd "$(dirname "$0")"
if ! command -v "$PYTHON" >/dev/null 2>&1; then
echo "Error: $PYTHON not found." >&2
exit 1
fi
if [ -d "$VENV_DIR" ]; then
echo "$VENV_DIR already exists. Delete it first to rebuild: rm -rf $VENV_DIR"
else
echo "Creating $VENV_DIR with $PYTHON ..."
"$PYTHON" -m venv "$VENV_DIR"
fi
# shellcheck disable=SC1091
source "$VENV_DIR/bin/activate"
python -m pip install --upgrade pip
python -m pip install -e ".[visualize]"
python -m pip install pytest
echo ""
echo "Done. Activate with: source $VENV_DIR/bin/activate"