How to set up a Python virtual environment on Windows

Use Visual Studio Code to set up an isolated virtual environment for your next Python or Data Science project

Abhinav Saraswat
5 min readMay 4, 2022
Photo by Markus Spiske on Unsplash

Python is a versatile programming language that can be used on a variety of platforms. In this short post, I will show you how to create a Python virtual environment on Windows. A virtual environment allows you to have multiple versions of Python installed on your computer, and to easily switch between them. This is useful if you are working on multiple projects that require different versions of Python.

Many people get the first taste of Python through an Anaconda installation when they start learning data science. This usually comes in the form of a Jupyter Notebook. For some, working with an IDE doesn’t come until much later if all.

While Anaconda is a useful starting point, I’ve found the Python installation from Anaconda can cause a fair amount of issues when working with IDE and wishing to do development outside of this environment. Anaconda also installs a number of potentially redundant starter packages which may not get used. This is the motivation behind this guide. Let’s get started!

Install a fresh copy of Python

--

--

Abhinav Saraswat

A wearer of many hats. Interested in NLP, geospatial, time series, financial modelling, game design