How to activate venv in Git Bash on Windows

Published: Last updated:


. venv/Scripts/activate


venv is a virtual environment for Python development.

Normally, on Windows, you create it with something like:

# create a new virtual named 'venv' in your current directory
python -m venv venv

And then activate it with one of:

# Powershell
# Batch script

However, in Git Bash, running the following doesn't appear to activate the environment:


According to this Stackoverflow answer, this is because running the script runs it in a new instance of the shell, which is destroyed after execution.

To activate it in your current shell:

. venv/Scripts/activate