【发布时间】:2021-12-01 00:19:22
【问题描述】:
安装的可塑性ai/magnitude (https://github.com/plasticityai/magnitude#installation)
尝试运行时出现以下错误:
ModuleNotFoundError: No module named 'spacy.lang.en.tag_map'
我已经使用 pip3 重新安装了最新版本的 spacy。运行python3。
我正在尝试运行的命令:
python3 -m pymagnitude.converter -i /Users/rob/Desktop/videos/glove.6B/glove.6B.300d.txt -o /Users/rob/Desktop/vectors/
完整输出:
Traceback (most recent call last):
File "/usr/local/Cellar/python@3.9/3.9.5/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 188, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
File "/usr/local/Cellar/python@3.9/3.9.5/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 111, in _get_module_details
__import__(pkg_name)
File "/usr/local/lib/python3.9/site-packages/pymagnitude/__init__.py", line 80, in <module>
from pymagnitude.third_party.allennlp.commands.elmo import ElmoEmbedder
File "/usr/local/lib/python3.9/site-packages/pymagnitude/third_party/allennlp/commands/__init__.py", line 8, in <module>
from allennlp.commands.configure import Configure
File "/usr/local/lib/python3.9/site-packages/pymagnitude/third_party/allennlp/commands/__init__.py", line 13, in <module>
from allennlp.commands.predict import Predict
File "/usr/local/lib/python3.9/site-packages/pymagnitude/third_party/allennlp/commands/predict.py", line 54, in <module>
from allennlp.predictors.predictor import Predictor, JsonDict
File "/usr/local/lib/python3.9/site-packages/pymagnitude/third_party/allennlp/predictors/__init__.py", line 13, in <module>
from allennlp.predictors.constituency_parser import ConstituencyParserPredictor
File "/usr/local/lib/python3.9/site-packages/pymagnitude/third_party/allennlp/predictors/constituency_parser.py", line 7, in <module>
from spacy.lang.en.tag_map import TAG_MAP
ModuleNotFoundError: No module named 'spacy.lang.en.tag_map'' ```
【问题讨论】:
-
您可能还需要:
sudo python3 -m spacy download en?参考:stackoverflow.com/questions/47295316/… -
我试过使用远程加载,同样的错误。假设我的 Spacy 安装存在问题。
-
哦,好的,那么我建议您真正确认所需的 spacy 的确切版本!我怀疑它不匹配。
-
啊,我有。通过 pip 完全卸载 spacy,并且工作正常。这么多一直在使用我的本地版本(需要不正确的版本)。谢谢,不知道为什么不早点想到!
-
谢谢@Nishant