How To Setup A Python Virtual Environment On Windows 10

How To Setup A Python Virtual Environment On Windows 10

How To Setup A Python Virtual Environment On Windows 10. A Virtual Environment or a venv is a Python module that creates a unique environment for each task or project. It installs the packages you need that are unique to that setting while keeping your projects neatly organized.

Venv never actually modifies the system’s default Python versions or modules that are installed on the system.

Using venv essentially allows for a unique working environment while avoiding any disruptions to other variants of Python that are used, but not related to our project.

In this article, we will teach you how to configure the Python virtual environment in Windows 10.


Buy Windows Virtual Private Server


Tip before starting: We recommend enabling the Windows Subsystem for Linux (WSL) in order to take full advantage of all the functionality of venv on Windows 10.

How To Setup A Python Virtual Environment On Windows 10.

Recommended Article: Tutorial install and use Aircrack-Ng on ubuntu 20.10

Why use WSL and how to enable it

Many of the tutorials for Python are written for Linux environments.

Most devs use Linux based packaging/installation tools.

Using WSL ensures compatibility between development and production environments.

To enable WSL, follow these steps:

1. Go to Start.

2. Search for “Turn Windows features on or off.”

3. Click the link to open the Windows control panel.

4. Open the Windows features pop-up menu.

5. Scroll down in that list to locate the “Windows Subsystem for Linux” option.

6. Select the checkbox.

7. Reboot.


How to Install Linux

There are multiple Linux distros that work with WSL. You can locate and install them from the Microsoft Store.

We recommend starting off with a Ubuntu 18.04 LTS distribution as it’s up to date, has an excellent support community, and is well documented.

1. To install Ubuntu, click this Ubuntu 18.04 LTS link.

This will open the Microsoft store where you can click on the Get button.

2. Once the download has completed, type “Ubuntu 18.04 LTS” into your Start menu.

3. Now, you’ll be asked to create a username and password as it will be your first time using this OS.

4. You will now be signed in automatically as the default user.

5. Lastly, you’ll need to run an update on the new OS.

You can accomplish this by running:

sudo apt update && sudo apt upgrade

Note: Windows do not handle upgrades for this OS so you will need to ensure Ubuntu stays up to date by running the update and upgrade commands manually.

You can install your distro using PowerShell.

To install one of those distros, navigate to the folder which contains the newly downloaded Linux distributions.

Once in that folder, run the following command in PowerShell

Note: app_name.aspx is the name of the distribution file.

Add-AppxPackage .\app_name.appx

Next, you must add the path to the distro into your Windows environment PATH using Powershell.

(eg. C:\Users\Admin\Ubuntu).

$userenv = [System.Environment]::GetEnvironmentVariable("Path", "User")    [System.Environment]::SetEnvironmentVariable("PATH", $userenv + ";C:\Users\Admin\Ubuntu", "User")

Now, you can start the distro by typing in uubuntu.exe.

Next, You should initialize the new instance.


How to Launch a distro

To finish the initialization of your newly installed distro, you will need to launch a new instance.

You can accomplish this by clicking on the launch button in the Microsoft app store, or by launching the distro’s .exe file from the Start menu.

Note: If using a Windows Server, you can start the distro’s launcher’s executable file (Ubuntu.exe) from the distro’s installation folder.

During the last stage of the installation, the distro’s files will be decompressed and stored locally on your PC.

This process may take a few minutes.


Setup steps

There are four basic steps to install a virtual environment on windows:

1. Install Python

2. Install Pip

3. Install VirtualEnv

4. Install VirtualEnvWrapper-win


Step 1. Install Python

Python 3.8.5 is the latest major release of Python.

Note: There is now a web-based installer for Windows. This installer will download the required software during the installation.

There are also Python redistributable files that contain the Windows builds, which makes it easier to include Python in another software bundle.

If you installed Ubuntu 18.04 from the above list, Python3 comes pre-installed.


Step 2. Install PIP

Python3 usually comes with pip preinstalled, however, if you get the error “pip command not found” simply use the following method to install pip:

curl -o

Download, and make sure you’re saving the file to your Desktop.

At your Windows Command Prompt, navigate to your Desktop and run the script.

After that, pip should work system-wide.


You may need to have administrative privileges at the command prompt to accomplish this task.

For more info on this, follow the directions from Start a Command Prompt as an Administrator from the Microsoft TechNet website.

cd Desktop  Python


Step 3. Install Virtualenv

Type the following command in the Windows Command Prompt:

pip install virtualenv

In your windows command prompt, head to your project location for Start virtualenv:

cd my_project

Once inside the project folder run:

virtualenv env


On Windows, virtualenv (venv) creates a batch file called:


To activate virtualenv on Windows, and activate the script is in the Scripts folder :



Recommended Article: How To Setup A Python Virtual Environment On Windows 10

Step 4. Install VirtualEnvWrapper-win

There are two main methods we recommend to install this batch script:

A) Using pip

pip install virtualenvwrapper-win

B) Install from source

git clone git://

You can then cd to the virtualenvwrapper-win folder and run:

python install


Also, see:

Tutorial Install Python on Windows

How to Set System Variable Path for Python

Tutorial Install PIP on Windows


Dear user, we hope you would enjoy this tutorial, you can ask questions about this training in the comments section, or to solve other problems in the field of Eldernode training, refer to the Ask page section and raise your problem in it as soon as possible. Make time for other users and experts to answer your questions.

How To Setup A Python Virtual Environment On Windows 10.


How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.

We Are Waiting for your valuable comments and you can be sure that it will be answered in the shortest possible time.

Leave a Reply

Your email address will not be published. Required fields are marked *

We are by your side every step of the way

Think about developing your online business; We will protect it compassionately

We are by your side every step of the way


7 days a week, 24 hours a day