Python编程遇到OSError:[E050] Can't find model 'en'.

参考链接:

[OSError: E050] Can’t find model ‘en’. It doesn’t seem to be a shortcut link, a Python package or a_Learning-CSDN博客

(1条消息) 解决Error: Couldn t link model to en_core_web_sm_椰楠liu的博客-CSDN博客

Python package or a valid path to a data directory.

问题描述

1
2
3
4
5
6
7
8
9
10
11
Namespace(afn='gelu', analysis=True, attn_pdrop=0.1, b1=0.9, b2=0.999, bpe_path='model/vocab_40000.bpe', clf_pdrop=0.1, data_dir='/ROCStoriesCloseTest', dataset='rocstories', desc='rocstories', e=1e-08, embd_pdrop=0.1, encoder_path='model/encoder_bpe_40000.json', l2=0.01, lm_coef=0.5, log_dir='log/', lr=6.25e-05, lr_schedule='warmup_linear', lr_warmup=0.002, max_grad_norm=1, n_batch=8, n_ctx=512, n_embd=768, n_gpu=4, n_head=12, n_iter=3, n_layer=12, n_transfer=12, opt='adam', resid_pdrop=0.1, save_dir='save/', seed=42, submission_dir='submission/', submit=True, vector_l2=False)
Traceback (most recent call last):
File "train.py", line 366, in <module>
text_encoder = TextEncoder(encoder_path, bpe_path)
File "/home/finetune-transformer-lm/text_utils.py", line 42, in __init__
self.nlp = spacy.load('en', disable=['parser', 'tagger', 'ner', 'textcat'])
File "/anaconda3/lib/python3.5/site-packages/spacy/__init__.py", line 21, in load
return util.load_model(name, **overrides)
File "/anaconda3/lib/python3.5/site-packages/spacy/util.py", line 119, in load_model
raise IOError(Errors.E050.format(name=name))
OSError: [E050] 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.
  • 解决办法
1
$ python3 -m spacy download en

这个时候,如果我们不是管理员用户还会出现另一个问题。

使用Anaconda提供的conda prompt下载python -m spacy download en以及python -m spacy download de时出现错误
Error: Couldn’t link model to 'en_core_web_sm’
1
一开始也没有仔细阅读错误提示,直接百度发现没什么可以用的解决方案,仔细一读后发现解决十分简单。
解决方案:在打开prompt的时候以管理员的身份运行。
2


Python编程遇到OSError:[E050] Can't find model 'en'.
https://fulequn.github.io/2020/11/Article202011182/
作者
Fulequn
发布于
2020年11月18日
许可协议