Skip to content

Instantly share code, notes, and snippets.

@hed0rah
Created March 20, 2026 04:44
Show Gist options
  • Select an option

  • Save hed0rah/71356531dcd44ccf98ceb2c2f6aa6202 to your computer and use it in GitHub Desktop.

Select an option

Save hed0rah/71356531dcd44ccf98ceb2c2f6aa6202 to your computer and use it in GitHub Desktop.
venv ez button
venv() {
local d="${1:-.venv}"
if [[ -d "$d" ]]; then
source "$d/bin/activate"
echo "activated $d ($(python --version), $(pip list 2>/dev/null | tail -n +3 | wc -l) packages)"
else
python3 -m venv "$d" && source "$d/bin/activate"
echo "created & activated $d ($(python --version))"
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment