IDLE: ModuleNotFoundError: No module named 'nltk'

149 views
Skip to first unread message

David Carlsen

unread,
Oct 15, 2020, 5:44:29 AM10/15/20
to nltk-users
I am using a Mac OS 10.14.6

I downloaded Anaconda for NLTK and Python and have been working through the NLTK Book using the Python Interpreter through my Mac Terminal.

When Chapter 2 introduced the IDLE text editor, I encountered the following error: 

>>> import nltk
Traceback (most recent call last):
  File "<pyshell#7>", line 1, in <module>
    import nltk
ModuleNotFoundError: No module named 'nltk'

My recent attempt to fix the issue was to add the path from the terminal to IDLE
TERMINAL
>>> nltk.__file__
'/Users/username/opt/anaconda3/lib/python3.8/site-packages/nltk/__init__.py'

IDLE
>>> sys.path.append('/Users/username/opt/anaconda3/lib/python3.8/site-packages/nltk/__init__.py')

and

>>> sys.path.append('/Users/username/opt/anaconda3/lib/python3.8/site-packages/nltk')

But received the same error.

My goal is to complete the NLTK Book as written avoiding workarounds if possible. I am able to import nltk with Spyder but not PyCharm, so solving this IDLE issue is very important.

Thank you,
David 
Reply all
Reply to author
Forward
0 new messages