pyenchant在Mac OS X上找不到词典文件 [英] pyenchant can't find dictionary file on Mac OS X

查看:207
本文介绍了pyenchant在Mac OS X上找不到词典文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在运行Lion的MacbookPro上安装pyenchant时遇到问题.我用自制软件和pip来安装附魔和pyenchant

自制安装附魔

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

我猜我没有在正确的文件夹中安装词典文件,但我不知道在其他位置还可以安装它们.

谢谢.

解决方案

附魔是懒惰的",需要aspell的后端支持.

因此,您需要做的是:

brew remove aspell
brew install aspell --lang=en

然后将安装dict,因此无需下载其他字典.

I'm having trouble installing pyenchant on a MacbookPro running Lion. I've used homebrew and pip to install enchant and pyenchant

homebrew install enchant

pip install pyenchant

I've also downloaded an English dictionary to the following folder:

/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

However, when I try to use enchant, I get the following error.

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

I'm guessing I don't have the dictionary files installed in the correct folder, but I don't know where else to install them.

Thanks.

解决方案

Enchant is 'lazy' and need backend support from aspell.

So, what you need to do is:

brew remove aspell
brew install aspell --lang=en

Then en dicts will be installed and so no need to download additional dicts.

这篇关于pyenchant在Mac OS X上找不到词典文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆