Python: How to setup virtual environment?

Different projects in python may require different modules and its dependencies. Also, there may be a necessity that certain projects be run on newer/older python releases hence introducing version conflicts. Virtual environment is a tool that helps you manage these scenarios.

To install virtualenv, use pip

$ pip install virtualenv

Now, create a virtual environment “myenv”

$ virtualenv myenv

To use the virtual environment, key in

$ source myenv/bin/activate

(if in windows, key in “myenv\Scripts\activate“)

The name of your virtual environment will appear on the left of the prompt

(myenv) …$

To exit out of the virtual environment, key in

$ deactivate

Share

Written by kurinchilamp


Website: http://

Leave a Reply

Your email address will not be published. Required fields are marked *

Kurinchi Calendar
February 2015
M T W T F S S
« Aug   Mar »
 1
2345678
9101112131415
16171819202122
232425262728