简体   繁体   English

我用 Anaconda 安装了 SpaCy,但如何添加模型

[英]I installed SpaCy with Anaconda but how do I add the models

I use Spyder with Anaconda.我将 Spyder 与 Anaconda 一起使用。 SpaCy is a standard module and installs just fine. SpaCy 是一个标准模块,安装得很好。 But there is no standard way to add the models.但是没有标准的方法来添加模型。
Simply putting them in the spacy/data directory as is suggested on some sites does not work.简单地将它们放在 spacy/data 目录中,如某些站点所建议的那样是行不通的。
It results in the following error:它导致以下错误:

FileNotFoundError: [Errno 2] No such file or directory: '/Users/username/anaconda/anaconda3/lib/python3.6/site-packages/spacy/data/en_core_web_sm/en_core_web_sm-2.1.0a0/parser/tok2vec_model' FileNotFoundError: [Errno 2] 没有这样的文件或目录:'/Users/username/anaconda/anaconda3/lib/python3.6/site-packages/spacy/data/en_core_web_sm/en_core_web_sm-2.1.0a0/parser/tok2vec_model'

What worked for me was the now considered "standard way":对我有用的是现在被认为是“标准方式”:

Step 1 : Install spacy Run the below command in Anaconda Prompt (Run as administrator)第 1 步:安装 spacy 在 Anaconda Prompt 中运行以下命令(以管理员身份运行)

conda install -c conda-forge spacy

Step 2 : Install language model第 2 步:安装语言模型

python -m spacy download en # default English model (~50MB)

python -m spacy download en_core_web_md # larger English model (~1GB)

In my case just the default small one (50mb) was fine.在我的情况下,默认的小(50mb)就可以了。

Source: copy-paste from here来源:从这里复制粘贴

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM