python - 导入spaCy错误

标签 python python-import spacy

当我尝试导入spaCy时(第一次),我收到以下错误:

>>>import spacy
Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    import spacy
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/spacy/__init__.py", line 10, in <module>
    from . import en, de, zh, es, it, hu, fr, pt, nl, sv, fi, bn, he, nb, ja
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/spacy/en/__init__.py", line 4, in <module>
    from ..language import Language
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/spacy/language.py", line 14, in <module>
    from .pipeline import DependencyParser, EntityRecognizer
  File "spacy/pipeline.pyx", line 1, in init spacy.pipeline (spacy/pipeline.cpp:16536)
    # coding: utf8
  File ".env/lib/python2.7/site-packages/thinc/extra/search.pxd", line 72, in init spacy.syntax.beam_parser (spacy/syntax/beam_parser.cpp:20037)
ValueError: thinc.extra.search.MaxViolation has the wrong size, try recompiling

建议我重新编译。我应该怎么做才能修复这个错误?

最佳答案

这可能是与 thincspacy 的版本冲突。 Thinc v6.9.0 已修复!

我建议您使用 sudo pip uninstall Thincsudo pip3 uninstall Thinc 进行卸载,并重新安装此处提供的 Thinc 版本 6.9.0:https://pypi.python.org/pypi/thinc

关于python - 导入spaCy错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46887236/

相关文章:

c++ - Python 或 C++ : Hijack http request to modify destination

python - 如何将训练数据分成更小的批处理来解决内存错误

python - NER(命名实体识别)文档中句子之间的相似度

python - spacy 相似性方法不能正常工作

python - 新的 Python 打印格式语句返回不同的结果。为什么?

Python POST 选中网页上的复选框

Python - os.path 不存在 : AttributeError: 'module' object has no attribute 'path'

python - 无法在 python 2.7.14 中导入任何模块(安装使用 pip)

Python 模块导入不起作用

python - 给定一个词,我们可以使用 Spacy 获得所有可能的引理吗?