virtualenv activate does not work

Question:

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 run activate, I get this error:

PS C:UsersBright BridgeDesktopautocomplete_demoScripts> 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?

Asked By: wanderer0810

||

Answers:

If you press WindowsKey + R, and type cmd when the box comes up, it should bring up the command line interface instead of powershell!

Answered By: AetherUnbound
Answered By: phunsukwangdu

Just Enter one PowerShell Command

  1. .Scriptsactivate

    Rather Then

  2. ./Scripts/activate

Answered By: AneelJ

Use command pompt instead of using power-shell
and run the same command

enter image description here

this should work

Answered By: MD SHAYON

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

Answered By: Bugbeeb

You basically needs to set execution policy for PowerShell

Step 1: Run PowerShell as Administartor

Step 2: Run Below Command

Set-ExecutionPolicy RemoteSigned

After successfull run, You will be able to activate vertual environemnt.

Enjoy 🙂

Answered By: Shashi Kumar Singh

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 ScriptsActivate.ps1

Hope it solves it!

Answered By: Rahul Chauhan

Execute .activate instead of activate

That worked for me.

Answered By: Luis Henriquez

after jumping to Scripts folder
cd Scripts
just write .activate
It works perfectly

Answered By: amaar

Instead of all variants it works with C:…venvscripts .activate.ps1
But before that, I changed my ExecutionPolicy to RemoteSigned. You can do it by next steps.

  1. Enter Set-ExecutionPolicy
  2. Enter RemoteSigned
  3. System should ask you if u wish to save changes. Answer with "Y"
    enter image description here
Answered By: Carl Tomson

1.Just add the complete path in cmd like this " cd.pyenvDjangoScripts" and press enter,

  1. Now you see the complete directory path in which you are.

  2. Now just type ".activate".

  3. this will activate your env.

NOTE:- try this in cmd not in vs code terminal or any where

Answered By: Akshat jain

On my windows I use this way with gitbash

cd .myenv/Scripts

then navigate and type

activate


works for me

Answered By: Long tran

I encountered the same problem in vscode after updating windows. What worked for me is:

  1. Navigating to the scripts folder of the target virtual environment
  2. typing .activate.
Answered By: Moetasim Rady
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.