Virtualenv is a python tool for developers to create isolated development environments. In these isolated development environments i.e virtualenvs, developers can install packages which won’t affect other virtualenvs or with the other python packages.  It solves your problem of dealing with package’s dependencies and at the same time maintains different versions that suits your project requirement.

Consider a scenario where you are working on project with Django 1.4 and then you have other project with Django 1.9. Its better to use virtualenv, where you can create two different development environments and install Python 2.7 in one and Python 3.0 in another. This way all your packages with different versions won’t get jumbled up and will make your life easier.

Setup Virtualenv on Mac

  1. To install virtual env you first need to install pip (python package management system). We will install pip systemwide.
     sudo easy_install pip
  2. Now to install virtualenv, just type the following command and your mac’s password when prompted.
     sudo pip install virtualenv
  3. Now to create a virtualenv, just type the following command
     virtualenv myenv
  4. To activate the virtualenv, you should navigate to myenv and type
     source bin/activate
  5. After you are done with your things, deactivate the virtualenv, type
     deactivate

 

Also read:  How to Download & Install Firefox for Mac OS

Did you like it?
Please Rate it below:

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...