AttributeError:当我尝试安装 en_core_web_sm 时,模块“click.utils”没有属性“_expand_args”

问题描述 投票:0回答:3

我正在尝试安装“en_core_web_sm”, 我运行的命令是:

  1. pip install spacy(完美运行并安装)
  2. python -m spacy 下载 en_core_web_sm(这里我收到错误“AttributeError: module 'click.utils' has no attribute '_expand_args'”)

请帮我解决这个问题

#代码

导入 nl_core_news_sm

加载预训练的荷兰语模型

nlp = nl_core_news_sm.load()

文件扩展名。设置为“pdf”或“doc(x)”

扩展名 = 'pdf'

def create_tokenized_texts_list(扩展名): '''创建两个列表,一个是候选人的名字,一个是标记化的 恢复从 .pdf 或 .doc 中提取的文本''' resume_texts,resume_names = [],[]

# Loop over the contents of the directory containing the resumes, filtering by .pdf or .doc(x)
for resume in list(filter(lambda x: extension in x, os.listdir(PROJECT_DIR + '/CV'))):
    if extension == 'pdf':
        # Read in every resume with pdf extension in the directory
        resume_texts.append(nlp(extract_text_from_pdf(PROJECT_DIR + '/CV/' + resume)))
    elif 'doc' in extension:
        # Read in every resume with .doc or .docx extension in the directory
        resume_texts.append(nlp(extract_text_from_word(PROJECT_DIR + '/CV/' + resume)))
        
    resume_names.append(resume.split('_')[0].capitalize())

这是我要运行的代码

python-3.x nlp spacy spacy-3
3个回答
1
投票

我遇到了同样的问题,然后这样解决了:首先,我更新了 Conda,在 Conda 自己的 Powershell 上运行这个命令

conda update -n base -c defaults conda
然后在同一个 PowerShell 中,运行 Spacy 文档中的这两个命令:
conda install -c conda-forge spacy python -m spacy download en_core_web_sm
来源:https://spacy.io/usage


0
投票

升级到 click v8,例如与

pip install 'click~=8.0'
.


0
投票

您必须通过运行

pip install -U click

来升级库点击

如果你使用的是Jupyter,升级后点击重置内核。

© www.soinside.com 2019 - 2024. All rights reserved.