klenwell information services : VirtualEnv

VirtualEnv

return to DevPython

Setting Up a New VirtualEnv

This will set up a new self-contained virtualenv in a directory called .venv with fabric and no association with system-wide Python site packages:
cd project/myproject
virtualenv .venv
.venv/bin/pip install fabric

# run a python script from virtualenv
.venv/bin/python myscript.py

# run a fabfile 
.venv/bin/fab test

# activate/deactivate env
source .venv/bin/activate
(.venv)$ deactivate


Installation

On Debian/Ubuntu:
# Install pip and virtualenv
sudo apt-get install python-pip python-dev build-essential 
sudo pip install pip --upgrade
sudo pip install virtualenv


References

http://mirnazim.org/writings/python-ecosystem-introduction/