Isolating Python environments with virtualenv

April 25, 2012

Reading time ~1 minute

If your’e hacking in many Python projects in parallell you will sooner or later run in to a Python package hell. The different projects might need different versions of Python or some package. I have also found it comfortable to know what packages the code I develop on actually depends on. A wonderful solution for this kind of problems is virtualenv.

virtualenv allows you to have a totally isolated Python environment for each of your projects.

sudo pip install virtualenv
cd /your/project-1
virtualenv virtualenv
source virtualenv/bin/activate

Your PS1 in Bash will now look something like this:

(virtualenv)[sebastian ~/git/git-hall-of-fame (master)]$

So anything you install via pip or easy_install now will be installed for this virtualenv only.

I have one virtualenv for each of my projects inside the git structure, and then I add virtualenv to .gitignore to keep the changes locally.

Running vim-airline with Maximum Awesome

I use [Maximum Awesome](https://github.com/square/maximum-awesome) when I code in [vim](http://www.vim.org/), it's a great starting place...… Continue reading

Quicksort implementation in Python

Published on August 04, 2014

Fibonacci generator in Python

Published on August 04, 2014