install-dict-packages sudachi

在Windows 7下的PyCharm中遇到模块'sudachidict_core'未找到和字典安装错误。解决方案是仅安装SudachiPy的核心依赖,避免安装完整或小型字典,以防止额外错误。如果遇到'system.dic'找不到的问题,将其从Python安装目录复制到相应位置或创建软链接。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

我是在windows7 下pychar 中执行的

  1. 错误信息
Traceback (most recent call last):
  File "C:\Users\lixianwei\venv\lib\site-packages\sudachipy\config.py", line 55, in create_default_link_for_sudachidict_core
    dict_path = Path(import_module('sudachidict').__file__).parent
  File "C:\Users\lixianwei\AppData\Local\Programs\Python\Python37\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'sudachidict'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\lixianwei\venv\lib\site-packages\sudachipy\config.py", line 58, in create_default_link_for_sudachidict_core
    import_module('sudachidict_core')
  File "C:\Users\lixianwei\AppData\Local\Programs\Python\Python37\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'sudachidict_core'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\pychar_work\tiny_tokenizer-master\tiny_tokenizer\word_tokenizers\sudachi_tokenizer.py", line 36, in __init__
    self.tokenizer = dictionary.Dictionary().create()
  File "C:\Users\lixianwei\venv\lib\site-packages\sudachipy\dictionary.py", line 37, in __init__
    self._read_system_dictionary(config.settings.system_dict_path())
  File "C:\Users\lixianwei\venv\lib\site-packages\sudachipy\config.py", line 106, in system_dict_path
    dict_path = create_default_link_for_sudachidict_core(output=f)
  File "C:\Users\lixianwei\venv\lib\site-packages\sudachipy\config.py", line 60, in create_default_link_for_sudachidict_core
    raise KeyError('`systemDict` must be specified if `SudachiDict_core` not installed')
KeyError: '`systemDict` must be specified if `SudachiDict_core` not installed'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:/pychar_work/tiny_tokenizer-master/tiny_tokenizer/word_tokenizer.py", line 86, in <module>
    tokenizer = WordTokenizer("sudachi", mode="A")
  File "D:/pychar_work/tiny_tokenizer-master/tiny_tokenizer/word_tokenizer.py", line 35, in __init__
    self.__setup_tokenizer()
  File "D:/pychar_work/tiny_tokenizer-master/tiny_tokenizer/word_tokenizer.py", line 58, in __setup_tokenizer
    mode=self.mode, with_postag=self.with_postag
  File "D:\pychar_work\tiny_tokenizer-master\tiny_tokenizer\word_tokenizers\sudachi_tokenizer.py", line 40, in __init__
    raise KeyError(msg)
KeyError: 'please install dictionary ( see https://github.com/WorksApplications/SudachiPy#install-dict-packages )'

这里面有两个问题:
1)ModuleNotFoundError: No module named ‘sudachidict_core’
2)KeyError: ‘please install dictionary ( see https://github.com/WorksApplications/SudachiPy#install-dict-packages )’

  1. 解决办法
pip install SudachiPy
pip install https://object-storage.tyo2.conoha.io/v1/nc_2520839e1f9641b08211a5c85243124a/sudachi/SudachiDict_core-20191030.tar.gz
sudachipy link -t core

执行过程:
在这里插入图片描述
在这里插入图片描述
然后在pychar中安装:
File ->Settings…->:
在这里插入图片描述
只安装红圈里两项就行了,别安装SudachiDict-full/small ,要不然还会报多个字典。。。的错误信息。

如果提示找不到system.dic,就到python安装目录下把这个东西copy过来。(当然也可以以软连接的形式连接过来)

从这里:
在这里插入图片描述
copy到这里:
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值