Sunday, July 10, 2022

[SOLVED] I cannot activate virtualenv on windows 10

Issue

I am trying to activate virtualenv on windows 10x64 by using this command:

source \env\Scripts\activate.bat

but I get this error:

source : The term 'source' is not recognized as the name of a cmdlet, function, script file, 
or operable program. Check the spelling of the name, or if a path was included, verify that 
the path is correct and try again.
At line:1 char:1
+ source \env\Scripts\activate.bat
+ ~~~~~~
    + CategoryInfo          : ObjectNotFound: (source:String) [], CommandNotFoundException  
    + FullyQualifiedErrorId : CommandNotFoundException

Solution

Ok about that, source is a shell command that only used in Linux systems, but not for windows systems. In window you should run it as...(Let's assume directory is inside of C:)

C:\Users\env\Scripts\activate.bat


Answered By - Govinda Malavipathirana
Answer Checked By - Dawn Plyler (WPSolving Volunteer)