Simple guide to making Python virtual environment in Windows .

MatchaLatt3
2 min readSep 5, 2021

--

*The following are steps that I usually take to create virtual environments(aka venv )in Windows10

  1. Ensure you have Python installed in your computer before continuing
  2. Open up your command prompt (type ‘cmd’ in the left bottom corner search bar if unsure)

*note that steps 3 and 4 are not necessary, but I like to place the venv folder in a larger folder containing my source code so I know which source codes the venv is applicable to

3. make a higher level folder to house the venv folder* by typing in the following(replace ‘newDir’ with your preferred higher level folder name)

mkdir newDir

*mkdir means make directory(aka folder)

*I call it venv folder as what venv looks like on a computer is actually a folder containing some scripts that gives the venv its functionality

4. navigate into the newly created folder (again replace ‘newDir’ with your folder name) with the following code

cd newDir

*cd means change directory

5. Create the venv by typing the following code( replace ‘newVenv’ with your preferred venv folder name)

python -m venv ./newVenv

6.To go inside aka activate the venv ( again replace ‘newVenv’ with your venv folder name) :

newVenv\Scripts\activate

A bracket containing your venv name will be appended to the front of the prompt if successful

in this case the name of my venv folder is ‘testingvenv’

7.To exit the venv(aka deactivate it) , type:

deactivate

Hope this article has been of some help to you. If you would like to know more about how virtual environment works under the hood, I’ve written a short article on it here as well :D

--

--

MatchaLatt3

Here's what I dabble in and read as a computer science major . I follow where my curious mind leads me