1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Command Line imports nltk, but Python/Idle won't :( (mac)

Discussion in 'Apple Mac' started by Nimic86, Sep 4, 2017.

Thread Status:
Not open for further replies.
  1. Nimic86

    Nimic86 Thread Starter

    Sep 4, 2017
    Whenever I use the command, import nltk (Natural Language Toolkit) from the shell, it works and imports nltk as expected.

    When I try to do so from Python however, I get the following error message:

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

    I vaguely know it's a "PATH" error, but nothing online has been able to help me, since they always use example paths which aren't my exact match, and I end up very lost.

    Here's this too, if it helps at all:
    >>> import sys
    >>> sys.path
    ['', '/Users/bobbybermudez/Documents', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages']

    I don't see 'nltk' anywhere up there, which from what I've gathered online is bad?

    Would greatly appreciate any help. Thanks :)
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/1195840

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice