Calendar

2012.05.
SUN MON TUE WED THU FRI SAT
- - 1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31 - -

プロフィール

Author:myzkkzy
FC2ブログへようこそ!

最新記事

最新コメント

最新トラックバック

月別アーカイブ

カテゴリ

これは忘れないように

Pythonを進めるための備忘録

--
----
--

スポンサーサイト

スポンサー広告| --:--| TOP
上記の広告は1ヶ月以上更新のないブログに表示されています。新しい記事を書く事で広告が消せます。
2011
0502
Mon

Mac OSX10.6にnltkをインストール

PythonC:0T:0| 11:21| TOP
NLTKにアクセス.downloadへ移動し,PyYAMLとNLTKをダウンロードします.

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
>>>


これでちゃんとインポートできるようになりました.

Comment

Name
Mail
URL
Title
Message

Pass
Secret

Top

Trackback

Trackback URL

Top

Copyright © これは忘れないように All Rights Reserved.

Designed by Flug / Illust by ふわふわ。り / Admin

FC2Ad

FC2ブログ


検索フォーム

RSSリンクの表示

リンク

Powered By FC2ブログ

今すぐブログを作ろう!

Powered By FC2ブログ

ブロとも申請フォーム

QRコード

QR