【发布时间】:2020-09-25 12:48:37
【问题描述】:
我已经编写了一些需要使用 NLTK punkt 的代码。我已将nltk 包含在requirements.txt 和setup.py 中。但是,当我使用 GitHub 操作运行项目的构建时,它会失败并出现此错误。
E LookupError:
E **********************************************************************
E Resource punkt not found.
E Please use the NLTK Downloader to obtain the resource:
E
E >>> import nltk
E >>> nltk.download('punkt')
告诉 GitHub 操作它需要 'punkt' 而不在代码中某处硬编码 nltk.download('punkt') 的标准方法是什么?
我是否应该在ci.yml 文件中添加一行,最好的方法是什么?
【问题讨论】:
-
我找到了一种解决方法,方法是在使用 pytest 运行测试之前将
echo -e "import nltk\nnltk.download('punkt')" | python3添加到ci.yml。但是,任何更优雅的解决方案都非常受欢迎。 -
尝试创建 nltk.txt 文件并包含
punkt? -
也只是使用了 andrea 提出的
ci.yml更改。似乎正在工作:D
标签: python continuous-integration nltk github-actions building-github-actions