Virtualenv in PowerShell for python

25 Jan

Today I was following a tutorial about Flask for python. While doing this I ran into a problem. I created a folder for my project. Then installed virtual environment module.

pip install virtual env 

ran successfully, module virualenv is now installed

virtualenv env 

this command also ran successfully. a virtual environment with name env is created.

so we have created a virtual environment. now to activate we need to run a batch file form inside the env folder.


This will not run in power-shell because its a batch file.

so I tried the next option.


this gave an error.

.\env\Scripts\activate.ps1 : File D:\Userfiles\Desktop\Py Flask\env\Scripts\activate.ps1 cannot be loaded because running scripts is disabled on this system. For more
information, see about_Execution_Policies at https:/

so how to activate our virtual environment?

lets remove the restriction.

 Set-ExecutionPolicy -Scope CurrentUser RemoteSigned 

the above command will enable running scripts for current user. we can disable this with the following command after we finish.

Set-ExecutionPolicy -Scope CurrentUser Restricted

running scripts is now enabled. lets try again.,with


It works! yay..

Leave a comment

Posted by on January 25, 2021 in Python


Tags: , , ,

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: