Can not activate a virtualenv in GIT bash mingw32 for Windows Can not activate a virtualenv in GIT bash mingw32 for Windows python python

Can not activate a virtualenv in GIT bash mingw32 for Windows


Doing Scripts/activate runs the script in a new instance of the shell, which is destroyed after the script execution. To run the script in your current shell, use either . Scripts/activate or source Scripts/activate.

Scripts/activate.bat does not work here because it is written in Batch, Windows cmd.exe language, and not Bash.


On Windows10, you could go in the directory of your virtualenv where the Scripts folder is placed then enter the below command

source ./Scripts/activate

Note the .(dot) without this it was giving error to me when I use it like above mentioned then the solution provided by Pierre worked for me.


How to activate then deactivate a venv with Git Bash


To access your python in Windows 10, you need to add the .exe when creating the virtual environment.

$ python.exe -m venv Scripts

Then you can move into the Scripts folder you created for the virtual environment.

$ cd Scripts/

Now you have to call on it to activate the virtual environment.

$ source ./Scripts/activate

When you are done you just deactivate the virtual environment.

$ deactivate

Screenshot how to activate/deactivate Git Bash venv