0

I am still somewhat new to Python programming. Having read the contributions to this topic, I am still stuck:

I have Python 3.7.4 installed (with Homebrew) on OS X 10.14. In terms of the path everything looks fine:

which python3    
/usr/local/bin/python3

I installed nltk with pip, using:

sudo pip3 install nltk

However, when I run python Python 3.7 and enter

import nltk

it says

Module not found error: No module named 'nltk' 

Any help would be greatly appreciated as I can't find any solutions that will work on my Mac.

PyKoch
  • 21

1 Answers1

2

I found the solution on this website. All I needed to do was to install nltk without sudo, so just

pip3 install -U nltk 

If anyone has wisdom to share why this might work, I'd still greatly appreciate it!

PyKoch
  • 21
  • 2
    Apparently -U tells pip to upgrade packages but that doesn't seem important (https://pip.pypa.io/en/stable/reference/pip_install/#pip-install). The leaving out of sudo would install it for your user rather than the "root" user which makes it easily accessible to you but no one else. I'd guess that you have a permissions issue when installing for all users as per https://stackoverflow.com/questions/36898474/how-to-install-a-module-for-all-users-with-pip-on-linux – Mokubai Aug 27 '19 at 09:59