virtualenv activate does not work
Solution 1
If you press WindowsKey + R
, and type cmd
when the box comes up, it should bring up the command line interface instead of powershell!
Solution 2
For those of you still interested, the output gives you the answer:
If you trust this command, instead type: ".\activate".
So use a relative path name to run the activate script in powershell, or use an absolute path
Solution 3
Just Enter one PowerShell Command
.\Scripts\activate
Rather Then
./Scripts/activate
Solution 4
You need to set windows execution policies. According to official documentation of virtualenv.
Run in powershell Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUse
Now you can activate virtual env. using \Scripts\Activate.ps1
Hope it solves it!
Solution 5
Execute .\activate instead of activate
That worked for me.
wanderer0810
I am a Senior Developer at Bright Bridge Web, and enjoy coding in Java, Python, and designing awesome websites!
Updated on June 23, 2022Comments
-
wanderer0810 almost 2 years
I am trying to create a virtual environment to test an api.
I can create the environment just fine using
virtualenv test
, then I can cd into it. When I try to runactivate
, I get this error:PS C:\Users\Bright Bridge\Desktop\autocomplete_demo\Scripts> activate activate : The term 'activate' 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 + activate + ~~~~~~~~ + CategoryInfo : ObjectNotFound: (activate:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException Suggestion [3,General]: The command activate was not found, but does exist in the current location. Windows PowerShell does not load commands from the current location by default. If you trust this command, instead type: ".\activate". See "get-help about_Command_Precedence" for more details.
I recently updated windows, and it replaced the cmd with Windows Powershell. My virtualenv worked fine with the cmd, so I suspect it may have to do with the way the Powershell does things.
How can I activate the virtualenv?
-
AetherUnbound almost 7 yearsIf you press
WindowsKey + R
, and typecmd
when the box comes up, does it still bring up powershell? -
wanderer0810 almost 7 yearsNo, it brings up the cmd. I have just been navigating to it by right clicking the start button. I'll see if it works through the cmd.
-
wanderer0810 almost 7 yearsIt works in the cmd. You should post this as an answer so I can accept this. Thanks a ton!
-
AetherUnbound almost 7 yearsGlad it worked out! That's quite odd that powershell comes up instead.
-
phunsukwangdu almost 7 years
-
-
Zizzipupp over 3 yearsAnd what are you meant to do with it??
-
Kakashi Hatake about 3 yearsThis did work for me as I used
.\env\Scripts\activate
But can anyone tell me why is my poweshell giving the same error as in the question above, Because it was working fine before today. Suddenly it started giving me this error. -
Jose R about 2 yearsThis solved the issue for me, in my case, I had to run it with the "./" at the beginning of the path in addition to this solution.