pythonpython-3.xubuntunltk

python error: ModuleNotFoundError: No module named 'NLTK'


Using Ubuntu terminal, when I type python then write import nltk, the package does work, but when I use the 'import nltk' inside a .py file , and run the command : python pyfile.py, I get this message: error: ModuleNotFoundError: No module named 'NLTK'

I tried nearly everything from installing pip3 to reinstalling nltk in python3, what could be the problem? note I am using python 3.6

Here is the code:

from NLTK.corpus import stopwords
stopWords = stopwords.words('english')
vectorizer = CountVectorizer(stop_words = stopWords)

Solution

  • Try downcasing it like this from nltk.corpus import stopwords