This terminal cast shows you how to install and create a virtualenv for python development using Ubuntu (actually LinuxMint) machine.
Install virtualenv and virtualenvwrapper using pip or easy_install
Find the location of virtualenvwrapper.sh shell script, copy the location.
Open the .bashrc or .bash_profile or .profile based on your system.
Append these two lines to the file
export WORKON_HOME=$HOME/.virtualenv
source <paste the location of the file>
Save and close the file, run source .profile or .bashrc or .bash_profile
As we are done with setting path for virtualenvwrapper, we are now going to create a virtualenv named ‘django’
mkvirtualenv django
The above command creates a virtual environment named django and installs the basic modules like distribute, argparse and wsgrief thus setting up a virtual python environment to work. You will automatically enter the virtualenv on successful creation.
To come out of virtualenv
deactivate
To enter into a virtualenv
workon django (or) name of the virtualenv you have created.
To install a package inside virtualenv
pip install packagename
Eg: pip install Django
If you already have requirement.txt file setup with your project
pip install -r requirement.txt
This installs the modules freezed inside requirement.txt using pip freeze command
(Note: No need to use sudo inside virtualenv, just use pip install)