Hello, I just purchased the book Natural Language Processing with
Python by Steven Bird, Ewan Klein & Edward Loper and am trying to use
it to learn Python / NLTK. However after installing Python, NLTK,
NumPy, and Matplotlib as suggested by the text I am unable to run the
two commands >>> import nltk and >>> nltk.download() to install the
data required by the book. I am using a MacBook Pro running Mac OS X
Ver. 10.6.3 (Snow Leopard) and using the Safari Browser. After
installing Python I am able to access the Python IDLE prompt without
difficulty. When I run the command >>> import nltk I get the following
response:
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
import nltk
ImportError: No module named nltk
I have read each of the discussions in this forum which address the
difficulty importing NLTK onto Macs but have not really been able to
glean any insight into solving my problem. I did try to check whether
I had two versions of Python on my Mac because one thread indicated
that Python is preloaded onto Snow Leopard and that having two
versions of Python may cause a problem when importing NLTK. When I
look for Python on my Mac Finder I can only find one version, when I
run the found version the idle prompt tells me I have:
Python 2.6.4 (r264:75821M, Oct 27 2009, 19:48:32)
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin
I also note that on the download page of
nltk.org it is suggested that
if you have a problem importing nltk to try:
If unable to "import nltk" after installing, do cd /tmp/nltk-
installer; sudo python setup.py install - this issue arises if the
NLTK installer could not locate a suitable version of Python on your
machine, or if you have more than one version installed)
When I try >>> cd /tmp/nltk-installer; sudo python setup.py install
I get the response:
SyntaxError: invalid syntax
One of the discussions also suggested trying
>>> sudo port install py26-nltk
which also returned
SyntaxError: invalid syntax
So at this point I am stuck. I wish to work my way through the Natural
Language Processing with Python text but am unable to get past page 3.
If anyone can help me with this issue I would greatly appreciate it.
Sincerely, George Orton
--
You received this message because you are subscribed to the Google Groups "nltk-users" group.
To post to this group, send email to
nltk-...@googlegroups.com.
To unsubscribe from this group, send email to
nltk-users+...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/nltk-users?hl=en.