Suppose you have an NLTK source located in /some/dir/ , so
dhg /some/dir/$ ls nltk ... app book.py ccg chat chunk classify ...
You can start the python interpreter from the directory in which the nltk source directory is nltk :
dhg /some/dir/$ python Python 2.7.1 (r271:86882M, Nov 30 2010, 10:35:34) >>> import nltk
Or you can add its location to the PYTHONPATH environment variable, which makes NLTK available from anywhere:
dhg /whatever/$ export PYTHONPATH="$PYTHONPATH:/some/dir/" dhg /whatever/$ python Python 2.7.1 (r271:86882M, Nov 30 2010, 10:35:34) >>> import nltk
Any other dependencies, including those dependent on NLTK, can also be added to PYTHONPATH in the same way.
source share