Skip to content

Instantly share code, notes, and snippets.

@GeroZayas
Created January 3, 2026 11:33
Show Gist options
  • Select an option

  • Save GeroZayas/508c7f980191e19d9e4b24fd5f312ec7 to your computer and use it in GitHub Desktop.

Select an option

Save GeroZayas/508c7f980191e19d9e4b24fd5f312ec7 to your computer and use it in GitHub Desktop.
ACT Alias to activate virtual env easily (Python)
# Activates a Python virtual environment by searching for common directory names.
function act {
for venv_dir in .venv venv env .env; do
if [ -f "$venv_dir/bin/activate" ]; then
. "$venv_dir/bin/activate"
echo "Virtual environment activated: '$venv_dir'"
return 0
fi
done
echo "Error: No virtual environment found." >&2
echo "Looked for: .venv, venv, env, .env" >&2
return 1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment