Installing NLTK on Mac OS X

If you are trying to install NLTK on your own Mac OS X computer, there are a couple of things that you might need to do differently from what the instructions given online tell you to do.

As background, here’s the thing: Mac OS X comes with Python pre-installed, but it is an older version of Python than we want (it is Python 2, we want Python 3). This adds complexity, because you need to install Python 3 yourself, but it also needs to co-exist with Python 2. This means that sometimes where the instructions say to type python or pip you need to type python3 or pip3 instead. There are also potentially “permissions” problems that can arise.

As far as I know at least, the following should work:

Then, when you want to start Python from the Terminal, start it with python3 (not pythonpython without the 3 will start Python 2 rather than Python 3). If you use IDLE in the Python 3.5 folder in your Applications folder, then you’ll be using Python 3. But as I mentioned in class, I prefer Terminal to IDLE myself, mostly due to the ability to use the “up-arrow” to retrieve previously typed commands. As far as I know, you cannot do this in IDLE.

Mostly this also applies to the Macs in the lab as well. So, you’ll generally want to type python3 on those machines as well.

Generally, this is irrelevant for the Windows installations, because Python 2 is not automatically included with Windows, so you can use python to get to Python 3. I believe.