-
2011
0502
Mon -
Mac OSX10.6にnltkをインストール
- Python| C:0| T:0| 11:21| TOP
NLTKにアクセス.downloadへ移動し,PyYAMLとNLTKをダウンロードします.
PyYAMLをソースからコンパイル.
NLTKは.dgmをそのまま実行し,インストール完了します.
ターミナルから,import nltk とするとインポートできるはずだったんですが,
と怒られます.
公式をよく見てみると,
要は,適切な場所にNLTKがインストールされていませんので,ターミナルで手動でインストール完了してくださいということです.tmpディレクトリにnltk-installerがあるはずなので,そこからインストールします.
これでちゃんとインポートできるようになりました.
PyYAMLをソースからコンパイル.
$ tar -zxvf PyYAML-3.09.tar.gz
$ cd PyYAML-3.09
$ python setup.py build
$ sudo python setup.py install
NLTKは.dgmをそのまま実行し,インストール完了します.
ターミナルから,import nltk とするとインポートできるはずだったんですが,
$ python
Python 2.7.1 (r271:86882M, Nov 30 2010, 10:35:34)
[GCC 4.2.1 (Apple Inc. build 5664)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import nltk
Traceback (most recent call last):
File "", line 1, in
ImportError: No module named nltk
>>>
と怒られます.
公式をよく見てみると,
Troubleshooting
It is possible that the NLTK installer gives an error message like "Errors occurred. Try installing again." This may indicate that the NLTK installer could not locate a suitable version of Python on your machine, or that you have more than one suitable version of Python installed. In this case, open a terminal window, type cd /tmp/nltk-installer and then type sudo python setup.py install.
要は,適切な場所にNLTKがインストールされていませんので,ターミナルで手動でインストール完了してくださいということです.tmpディレクトリにnltk-installerがあるはずなので,そこからインストールします.
$ cd /tmp
$ ls -l
total 0
drwxr-xr-x 9 root staff 306 4 11 14:12 nltk-installer
$ cd nltk-installer
$ sudo python setup.py install
$ python
Python 2.7.1 (r271:86882M, Nov 30 2010, 10:35:34)
[GCC 4.2.1 (Apple Inc. build 5664)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import nltk
>>>
これでちゃんとインポートできるようになりました.



