I created a virtualenv around my project, but when I try to activate it I cannot. It might just be syntax or folder location, but I am stumped right now.
You can see
source command is officially for Unix operating systems family and you can't use it on windows basically. instead, you can use venv\Scripts\activate
command to activate your virtual environment.
I had the same problem. I was using Python 2, Windows 10 and Git Bash. Turns out in Git Bash you need to use:
source venv/Scripts/activate
You can run the source command on cygwin terminal
If wants to open virtual environment on Windows then just remember one thing on giving path use backwards slash not forward.
This is right:
D:\xampp\htdocs\htmldemo\python-virtual-environment>env\Scripts\activate
This is wrong:
D:\xampp\htdocs\htmldemo\python-virtual-environment>env/Scripts/activate
I have a hell of a time using virtualenv
on windows with git bash, I usually end up specifying the python binary explicitly.
If my environment is in say .env
I'll call python via ./.env/Scripts/python.exe …
, or in a shebang line #!./.env/Scripts/python.exe
;
Both assuming your working directory contains your virtualenv (.env
).