作成中〜
Open Finder>Applications>Utilities>Terminal and type python -V to find out what version of Python is installed
Install Setuptools: Download the corresponding version of Setuptools fromhttp://pypi.python.org/pypi/setuptools (scroll to the bottom, and pick the filename that contains the right version number and which has the extension .egg). Install it by typingsudo sh Downloads/setuptools-...egg, giving the location of the downloaded file.
Install Pip: run sudo easy_install pip
Install Numpy (optional): run sudo pip install -U numpy
Install PyYAML and NLTK: run sudo pip install -U pyyaml nltk
Test installation: run python then type import nltk
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Python/2.7/site-packages/nltk/text.py", line 454, in dispersion_plot
dispersion_plot(self, words)
File "/Library/Python/2.7/site-packages/nltk/draw/dispersion.py", line 27, in dispersion_plot
raise ValueError('The plot function requires the matplotlib package (aka pylab).'
ValueError: The plot function requires the matplotlib package (aka pylab).See http://matplotlib.sourceforge.net/
>>> text4.dispersion_plot(["citizenz","democracy","freedom","duties","America"])
http://sourceforge.net/projects/matplotlib/files/matplotlib/matplotlib-1.1.1/