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

shu*_* k. 3 nlp python-3.x spacy spacy-3

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

  1. pip install spacy (完美运行并安装)
  2. python -m spacy download en_core_web_sm (这里我收到错误“AttributeError:模块'click.utils'没有属性'_expand_args'”)

在此输入图像描述

请帮我解决这个问题。

#代码

导入nl_core_news_sm

加载预训练的荷兰语语言模型

nlp = nl_core_news_sm.load()

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

扩展名='pdf'

def create_tokenized_texts_list(extension): '''创建两个列表,一个包含候选人姓名,另一个包含从 .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())
Run Code Online (Sandbox Code Playgroud)

这是我试图运行的代码

小智 6

您需要至少 8.0.0 的 Click 版本才能解决此问题。使用以下命令升级到最新版本

pip install --upgrade click