Creating an Environment in Python in Three Steps

Using Conda to Create Virtual Python Environments

Shreya Chaudhary
1 min readJul 31, 2020

What is an Environment and Why Should I Care?

An environment allows one to keep all of their packages they use for a project together, isolated and not combined with all of the packages ever used on the machine. One potential benefit of keeping all your packages together is that it makes it much easier to deploy, for example in Heroku, as all of your dependencies are in one location. We can use conda to create environments to organise yours projects and the libraries you use.

Creating Your Environment

Step 1: Download Conda

You can figure out how to download conda based on your machine here.

Step 2: Create the Environment

In your terminal or console, type the following:

conda create -n YOUR_ENVIRONMENT_NAME

Step 3: Enter Your Environment

Next, we’ll need to activate your environment:

conda activate YOUR_ENVIRONMENT_NAME

Future Step 4: Leave Your Environment

Once you’re done with the environment you’re using, you can always leave it with:

conda deactivate

And That’s It!

Now you can create Python environments. You can start creating your own projects now with its specific libraries isolated.

--

--