python的os为啥找不到文件_python – pyenchant在Mac OS X上找不到字典文件

我在运行Lion的MacbookPro上安装pyenchant时遇到了麻烦.我用自制软件和点子来安装附魔和诡计

homebrew install enchant

pip install 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 "", line 1, in

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

我猜我没有在正确的文件夹中安装字典文件,但我不知道在哪里安装它们.

谢谢.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值