Hello, While searching the web for a solution to this problem I found
this link:
http://parkerboundy.com/post/3455652319/natural-language-toolkit-on-os-x-10-6-6
In it it described a problem similar to the one I am facing. Here is a
quote about how the author solved the problem:
"Natural Language Toolkit on OS X 10.6.6
I’ve been struggling for the last few hours to get the Natural
Language Toolkit (nltk) running on my mac, so I thought I would do a
quick write up for anyone else who might be having similar problems.
For those who don’t know, the nltk is:
“Open source Python modules, linguistic data and documentation for
research and development in natural language processing and text
analytics, with distributions for Windows, Mac OSX and Linux.”
Macs come with python preinstalled (mine had 2.6.x) on it. One would
think this is a good thing (less work!) but you’d be wrong. After
doing a bit of read, Apple’s python is out of date and many libraries
don’t support it. That means we need to install another version of
Python. This is what caused me the biggest headache and an hour or so
of my time. You need the 32bit version of Python in order to run the
nltk’s dependancies. As of writing this the most current version is
2.7.1 and can be found here.
Once you have installed Python you can install the nltk and its
dependencies. Once I figured out the 64bit problem the rest is quick
and simple. I started by installing PyYAML. Download and unpack the
PyYAML folder, and move it to your desktop. Fire up the Terminal
(Applications > Utilities > Terminal) and use the following commands:
cd Desktop/PyYAML-3.09
sudo python setup.py install
No big deal. Now we need to install NumPy and MatPlotLib. They both
have binaries that can be downloaded and are quick and easy to install
(as long as you have the 32 bit version of Python :P).
The last step is to install the nltk. The latest version can be found
here. The nltk also comes in a binary form for OS X, but for some
reason it doesn’t install in the proper location (it wants to install
in Apple’s python location, not the location of our new install). To
fix this, we need to use the terminal and run the following commands:
cd /tmp/nltk-installer
sudo python setup.py install
"
I followed the instructions given, downloaded and installed PyYAML
then I tried changing directories to the
cd /tmp/nltk-installer
then typed sudo python setup.py install
After doing this I was able to get nltk to import. It appears that the
big issue is that nltk doesn't want to install in the proper location.
As the author of the link says it wants to install in Apple's python
location but not in the location of the new install. However I have
two systems that are on LION using 2.7.1. On my MacBook Pro I followed
the directions as outlined and was able to import nltk without
difficulty. However, on my Mac Pro I was able to install PyYAML
without difficulty but when I tried to change directories to the /tmp/
nltk-installer directory I got the error message No such file or
directory.
So now my question becomes does anybody know how to find out what the
directory location is of the nltk install so that I can change to the
correct directory prior to executing the sudo python setup.py install
command. Hopefully if I can get the correct install directory then I
should be able to import nltk. Sincerely, George