我在运行 Lion 的 MacbookPro 上安装 pyenchant 时遇到问题。我使用 homebrew 和 pip 来安装 enchant 和 pyenchant
自制安装附魔
点安装 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
-rw-rw-rw-@ 1 mycomputer staff 1017 May 4 2007 README_en_US.txt
drwx------@ 2 mycomputer staff 68 Jun 6 13:38 en_US
-rw-rw-rw-@ 1 mycomputer staff 3045 May 4 2007 en_US.aff
-rw-rw-rw-@ 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
我猜我没有在正确的文件夹中安装字典文件,但我不知道在哪里安装它们。
谢谢。