参考:https://www.zhihu.com/question/56095738/answer/283999308
安装spacy en_core_web_sm报错
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host=‘raw.githubusercontent.com’, port=443): Max retries exceeded with url: /explosion/spacy-models/master/shortcuts-v2.json (Caused by NewConnectionError(’
无论是装spacy还是en的库都会报这个错(anaconda prompt)。。。后来用pycharm装上了spacy(2.3.0),也用同样方法装了en, en_core_web_sm之类,但是还是会报错:no module named en
后来我从github上通过pip安装en_core_web_sm,由于我没有找到2.3.0版本,只能装了2.1.0
pip --default-timeout=10000 install https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.1.0/en_core_web_sm-2.1.0.tar.gz
然而:
似乎是在说版本不对应。。。。,而且pycharm依然报错No module named ‘en’
可算让我给找着了:https://github.com/explosion/spacy-models/releases/tag/en_core_web_sm-2.3.0
pip --default-timeout=10000 install https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.3.0/en_core_web_sm-2.3.0.tar.gz
import spacy
spacy.load("en_core_web_sm")
使用,参考:https://blog.csdn.net/lrt366/article/details/90269582
注意,在torchtext中使用spacy时,由于field的默认属性是tokenizer_language=‘en’
TEXT = torchtext.data.Field(tokenize='spacy', tokenizer_language='en_core_web_sm')
另附安装en_core_web_md的方式:
pip --default-timeout=10000 install https://github.com/explosion/spacy-models/releases/download/en_core_web_md-2.3.0/en_core_web_md-2.3.0.tar.gz