DEV Community

Anoop AK
Anoop AK

Posted on • Edited on

15 2

Enabling Python Virtualenv in Windows PowerShell

Virtualenv is one of the most important tools in Python developers' toolkit.
Now that Virtualenv supports PowerShell natively, you can run the script

venv/Scripts/Activate.ps1

which is the equivalent of venv/bin/activate in Linux

However, you might run into the following error when you try to run the script

venv\Scripts\Activate.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies

You may use Set-Execution Policy to allow the current user to execute scripts as follows

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

That's it! You should now be able to execute Activate.ps1 and get a fully isolated Python development environment for your projects.

Top comments (4)

Collapse
 
mrmoshkovitz profile image
MrMoshkovitz

Thank you :)

Collapse
 
aka_anoop profile image
Anoop AK

Glad it helped 👍

Collapse
 
afey4rce profile image
ABENAMA Franck Emmanuel

Thanks

Collapse
 
mosaablaboune profile image
Mosaab Laboune

Thanks !

Image of PulumiUP 2025

From Cloud to Platforms: What Top Engineers Are Doing Differently

Hear insights from industry leaders about the current state and future of cloud and IaC, platform engineering, and security.

Save Your Spot

👋 Kindness is contagious

Dive into this informative piece, backed by our vibrant DEV Community

Whether you’re a novice or a pro, your perspective enriches our collective insight.

A simple “thank you” can lift someone’s spirits—share your gratitude in the comments!

On DEV, the power of shared knowledge paves a smoother path and tightens our community ties. Found value here? A quick thanks to the author makes a big impact.

Okay