Python解决Can‘t find model ‘en‘. It doesn‘t seem to be a shortcut link, a Python package or a valid(代码
Posted Better Bench
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Python解决Can‘t find model ‘en‘. It doesn‘t seem to be a shortcut link, a Python package or a valid(代码相关的知识,希望对你有一定的参考价值。
问题
在使用以下代码时,报错Can’t find model ‘en’. It doesn’t seem to be a shortcut link, a Python package or a valid path to a data directory.
import spacy
NLP = spacy.load('en')
解决办法
没有下载模型
(1)方法一
pip install spacy && python -m spacy download en
使用方式
import spacy
NLP = spacy.load('en')
(2)方法二
下载
pip install https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.3.1/en_core_web_sm-2.3.1.tar.gz --no-deps
使用
import spacy
NLP = spacy.load('en_core_web_sm')
或者
import en_core_web_sm
NLP = en_core_web_sm.load()
以上是关于Python解决Can‘t find model ‘en‘. It doesn‘t seem to be a shortcut link, a Python package or a valid(代码的主要内容,如果未能解决你的问题,请参考以下文章
python spacy [E050] Can't find model 'en_core_web_sm'
解决Error: Can't find Python executable "python", you can set the PYTHON env variable(示例
Error: Can't find Python executable "python", you can set the PYTHON env variable.解决办法
解决Error: Can't find Python executable "python", you can set the PYTHON env variable