spacy.load(‘en‘) 失败的解决方法

看似简单,但会碰到很多耽误时间问题,记录一下,为渐行渐远的记性做个保障

主要方法:

python -m spacy download en
python -m spacy download de
import spacy
spacy_en = spacy.load('en')
spacy_de = spacy.load('de')

问题 1:

Connection aborted.', ConnectionResetError(10054, '远程主机强迫关闭了一个现有 的连接。', None, 10054, None)

  • 解决方法:离线 安装Spacy以及de和en模块
 - 官网连接为:https://spacy.io/ 
 - download en_core_web_md 和  de_core_news_md 两个离线包
 - pip install \你的下载路径\en_core_web_md-1.2.0.tar.gz
  • 注意!:一定要和spacy版本对应,比如你的spacy是2.3.x 版本的,那么en_core_web_md 和 de_core_web_md 最好都是2.3.x 版本的(我之前就是吃了这个亏,卸来卸去,都成糊糊了)

问题 2 :

Can't find model 'en'. It doesn't seem to be a shortcut link, a Python package or a data directory.

  • 解决方法:
    -https://blog.csdn.net/qq_27009517/article/details/83825523
    -https://blog.csdn.net/weixin_40408636/article/details/85126513

问题 3 :

spacy在load模型时出现KeyError: 'PUNCTSIDE_FIN'

  • 原因:

spacy版本与加载的模型 (下载的en_core_web_sm)版本不兼容, 如 问题1

  • 解决方法:
- conda remove spacy
- conda install -c conda-forge spacy

问题 4 :

OMP: Error #15: Initializing libiomp5md.dll, but found libiomp5md.dll already initialized. OMP: Hint This means that multiple copies of the OpenMP runtime have been linked into the program. That is dangerous, since it can degrade performance or cause incorrect results. The best thing to do is to ensure that only a single OpenMP runtime is linked into the process, e.g. by avoiding static linking of the OpenMP runtime in any library. As an unsafe, unsupported, undocumented workaround you can set the environment variable KMP_DUPLICATE_LIB_OK=TRUE to allow the program to continue to execute, but that may cause crashes or silently produce incorrect results. For more information, please see http://www.intel.com/software/products/support/.
在这里插入图片描述

  • 解决方法:允许副本存在,忽略报错;在程序中添加如下:
 - import os os.environ["KMP_DUPLICATE_LIB_OK"]="TRUE"
  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值