Skip to content

Instantly share code, notes, and snippets.

@panuta
Created March 6, 2012 08:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save panuta/1984908 to your computer and use it in GitHub Desktop.
Save panuta/1984908 to your computer and use it in GitHub Desktop.
My Python Developer Environment Guide

iPython

Install iPython

sudo pip install ipython

Using iPython within virtualenv

Add the following code to ~/.ipython/ipython_config.py

import site
from os import environ
from os.path import join
from sys import version_info

if 'VIRTUAL_ENV' in environ:
    virtual_env = join(environ.get('VIRTUAL_ENV'),
                       'lib',
                       'python%d.%d' % version_info[:2],
                       'site-packages')
    site.addsitedir(virtual_env)
    print 'Using Virtualenv =>', virtual_env
    del virtual_env
del site, environ, join, version_info

However, Django shell cannot detect iPython while using virtual environment.

lxml on Ubuntu

sudo apt-get install libxml2-dev libxslt-dev
pip install lxml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment