Virtual Environment

Posted on Sun 01 March 2015 in Python • Tagged with django, pip, python, virtualenvLeave a comment

While leaning web developing using Django and Python, I found out VirtualEnv or Virtual Environment is widely used, in first I didn't get it because I came from Microsoft .NET Framework development platform, so I thought of writing a post about it to make simple.

What is Virtual Environment?

VirtualEnv or Virtual Environment is a way to create isolated development environment each one has it's own packages and specific package version, for example VirEnv1 has Django 1.6 and VirEnv2 has Django 1.7, this isolation will keep your project packages dependency clear, isolated, and as I'll show you below that you can replicate the environment with one command and file, so if you work in team it's easy to share the same environment among the team.

virtualenv 1 virtualenv 2

How to install VirtualEnv?

VirtualEnv is a python package so to install is you need to install pip first.

  1. Open terminal and type the following command

    sudo apt-get install python-pip

  2. After finish installing pip type the following command to install virtual environment

    sudo pip install virtualenv

  3. After finish installing virtualenv, type the following command to create folder to store your virtual environments

    mkdir .virtualenvs

How to create virtualenv?

After install virtualenv you are …

Continue reading