macos – Python cant find module NLTK

macos – Python cant find module NLTK

On OS X you could have multiple installation of Python, so investigate it first:

$ which python python2 python3

$ which pip pip2 pip3

All within /usr/bin are built-in and all other in /usr/local/bin are external installed by Homebrew or some other package manager.

If youre using pip or pip3 from /usr/local, then youve to use the same Python instance, otherwise theyre different instances.

Just install it via pip:

pip install nltk

or for Python 3:

pip3 install nltk

then run the right Python instance from /usr/local/bin or update your PATH system variable.

Make sure you install the actual Python for Mac, not the one built into the console. Then, install pip by executing this script. Then skip to part 3 of the instructions and go from there.

macos – Python cant find module NLTK

Try this

pip install --user -U nltk

Leave a Reply

Your email address will not be published. Required fields are marked *