Create your Python Virtual Environment in Super Ultra Fast Steps

by Mohamed Eldesouki

Posted on Sept. 27, 2017

The post shows two ways to create a virtual environment in Python; using the virtualenv package and using conda package.

create your virtual environment via virtualenv

Install the virtualenv package using the following;

pip install virtualenv

to create an environment run the following command:

virtualenv <env_name>

to activate the environment just run

source <env_name>/bin/activate

If you want to install a special version of Python for the environment run the following instead:

virtualenv --python=<path_of_python_2_or_3> <env_name>

Use which python To know the path to your version

To close your environment type:


Conda virtual environment

You need to have Anaconda installed to use Conda to create an environment. Download and install Anaconda from here. After Installing Anaconda use the following to create the environment:

conda create --name <env_name> python=3.6

to activate the environment just run

source activate <env_name>

To close your environment type:

source deactivate

To delete your environment type:

conda remove --name <env_name> --all

Leave a Comment: