Getting started with Python NLTk on Ubuntu

Getting started with Python NLTk on Ubuntu

Last updated:

You may start out with the NLTK Book, which is one of the most widely used introductions for Python NLTK so here's some steps that will save you some trouble (installing required modules and so on) and some hours' worth of googling for answers:

We're using Python 2.7 on Ubuntu

Python stuff

$ sudo apt-get install python-pip
$ sudo apt-get install python-setuptools

Numpy

(For numeric operations)

$ pip install numpy

Matplotlib

(For plotting graphs)

$ sudo apt-get install libfreetype6-dev
$ sudo apt-get install python-tk
$ pip install matplotlib

NLTk

(The library itself)

$ pip install nltk

HEADS-UP pip does not, by default, install missing system dependencies (i.e. ubuntu packages) if they're needed for a python package.

For example, if pip install scipy fails, try doing apt-get install python-scipyinstead.