Setting Up a Virtual Environment

Laine G
1 min readDec 6, 2019

This article assumes that you have already installed Python 3 and virtualenv

In the Terminal, make sure you have created and navigated to the project’s folder. This is a new folder you create for your project.

Special Note: Don’t enter the dollar sign ($). It is the cursor prompt.

$ mkdir mynewproject
$ cd mynewproject

Create the new virtul environment. You can name it anything you like. I’m going to use env as my virtual environment name. I’ve found two different ways to accomplish this task. One is:

$ python3 -m venv env

…and the other is:

$ virtualenv env

At this point in time, I don’t know if one is better than the other, but both appear to work the same.

After the the virtual environment has been created, it then needs to be activated. Do so by entering the following in the Terminal window.

$ source env/bin/activate

The virtual environment should now be running and ready to go.

--

--