我是在windows7 下pychar 中执行的
- 错误信息
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 )’
- 解决办法
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到这里: