我在運行Lion的MacbookPro上安裝pyenchant時遇到問題。我用自制和PIP安裝附魔和pyenchantpyenchant在Mac OS X上找不到字典文件
自制安裝附魔
PIP安裝pyenchant
我還下載了一本英語詞典到以下文件夾:
/usr/local/Cellar/python/2.7.3/lib/python2.7/site-packages/enchant/share/enchant/myspell
-rw-r--r-- 1 mycomputer admin 75 Jun 6 13:34 README.txt
[email protected] 1 mycomputer staff 1017 May 4 2007 README_en_US.txt
[email protected] 2 mycomputer staff 68 Jun 6 13:38 en_US
[email protected] 1 mycomputer staff 3045 May 4 2007 en_US.aff
[email protected] 1 mycomputer staff 696131 May 4 2007 en_US.dic
但是,當我嘗試使用附魔時,出現以下錯誤。
>>> import enchant
>>> d = enchant.Dict('en_US')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/Cellar/python/2.7.3/lib/python2.7/site-packages/enchant/__init__.py", line 502, in __init__
self._switch_this(broker._request_dict_data(tag),broker)
File "/usr/local/Cellar/python/2.7.3/lib/python2.7/site-packages/enchant/__init__.py", line 264, in _request_dict_data
self._raise_error(eStr % (tag,),DictNotFoundError)
File "/usr/local/Cellar/python/2.7.3/lib/python2.7/site-packages/enchant/__init__.py", line 218, in _raise_error
raise eclass(default)
enchant.errors.DictNotFoundError: Dictionary for language 'en_US' could not be found
我猜我沒有在正確的文件夾中安裝字典文件,但我不知道在哪裏安裝它們。
謝謝。