DEV Community

Shrikant Dhayje
Shrikant Dhayje

Posted on • Edited on • Originally published at codewithshriekdj.netlify.app

7 1

Python venv or virtualenv won't activate on windows Powershell

Problem

Unable to Activate the Virtual Environment In Windows Operating System.

Details

The issue is specifically for Powershell of Windows Operating System While Activating the virtualenv of Python which does not allow us to run scripts in Powershell Window.

First Solution

Try Running below command in Powershell ( This only Solve for Current Window )

Set-ExecutionPolicy Unrestricted -Scope Process
Enter fullscreen mode Exit fullscreen mode

Second Solution

Try Running below command in Powershell ( Whole User )

Set-ExecutionPolicy Unrestricted -Force -Scope CurrentUser
Enter fullscreen mode Exit fullscreen mode

Third Solution

Don't run the File at .\Scripts\activate or .\Scripts\activate.bat.
Instead Run The File At location .\Scripts\activate.ps1.

Fourth Solution

Use the Unix like command Shells Instead of Powershell for example Git Bash Is Lightweight Cli Tool.


Conclusion

If you found this useful then please share this and follow me! Also check out Buy Me A Coffee if you want to support me on a new level!

Buy me a coffee

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

Top comments (3)

Collapse
 
labspl profile image
Wojciech

Setting ExecutionPolicy to unrestricted is highly dangerous and discouraged

Collapse
 
shriekdj profile image
Shrikant Dhayje

For A normal user it is highly dangerous but if you are a programmer and know what is the script about then no problem for changing.

Thanks for Informing Btw 😊

Collapse
 
shriekdj profile image
Shrikant Dhayje • Edited

if you have any other solutions i will happy to know😊

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more