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?
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!
- first make virtualenv with
virtualenv pymote_env
- Activate environment:
pymote_envScriptsactivate
-
in your case:-
- first make virtualenv with
virtualenv test
- Activate environment:
testScriptsactivate
-
http://pymote.readthedocs.io/en/latest/install/windows_virtualenv.html
Just Enter one PowerShell Command
-
.Scriptsactivate
Rather Then
-
./Scripts/activate
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
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 🙂
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!
Execute .activate instead of activate
That worked for me.
after jumping to Scripts folder
cd Scripts
just write .activate
It works perfectly
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.
- Enter Set-ExecutionPolicy
- Enter RemoteSigned
- System should ask you if u wish to save changes. Answer with "Y"
enter image description here
1.Just add the complete path in cmd like this " cd.pyenvDjangoScripts" and press enter,
-
Now you see the complete directory path in which you are.
-
Now just type ".activate".
-
this will activate your env.
NOTE:- try this in cmd not in vs code terminal or any where
On my windows I use this way with gitbash
cd .myenv/Scripts
then navigate and type
activate
works for me
I encountered the same problem in vscode after updating windows. What worked for me is:
- Navigating to the scripts folder of the target virtual environment
- typing
.activate
.
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?
If you press WindowsKey + R
, and type cmd
when the box comes up, it should bring up the command line interface instead of powershell!
- first make virtualenv with
virtualenv pymote_env
- Activate environment:
pymote_envScriptsactivate
-
in your case:-
- first make virtualenv with
virtualenv test
- Activate environment:
testScriptsactivate
- first make virtualenv with
-
http://pymote.readthedocs.io/en/latest/install/windows_virtualenv.html
Just Enter one PowerShell Command
-
.Scriptsactivate
Rather Then
-
./Scripts/activate
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
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 🙂
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!
Execute .activate instead of activate
That worked for me.
after jumping to Scripts folder
cd Scripts
just write .activate
It works perfectly
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.
- Enter Set-ExecutionPolicy
- Enter RemoteSigned
- System should ask you if u wish to save changes. Answer with "Y"
enter image description here
1.Just add the complete path in cmd like this " cd.pyenvDjangoScripts" and press enter,
-
Now you see the complete directory path in which you are.
-
Now just type ".activate".
-
this will activate your env.
NOTE:- try this in cmd not in vs code terminal or any where
On my windows I use this way with gitbash
cd .myenv/Scripts
then navigate and type
activate
works for me
I encountered the same problem in vscode after updating windows. What worked for me is:
- Navigating to the scripts folder of the target virtual environment
- typing
.activate
.