[英]GitHub Actions fails when NLTK “punkt” is needed
I have written some code which needs to use NLTK's punkt.我已经编写了一些需要使用 NLTK 的 punkt 的代码。 I have included
nltk
in the requirements.txt
and in the setup.py
.我已将
nltk
包含在requirements.txt
和setup.py
中。 However, when I run the build of my project using GitHub actions, it fails with this error.但是,当我使用 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')
What is the standard way to tell GitHub actions that it needs 'punkt'
without hard coding nltk.download('punkt')
somewhere into the code?告诉 GitHub 动作它需要
'punkt'
而不在代码中某处硬编码nltk.download('punkt')
的标准方法是什么? Should I add a line in the ci.yml
file, and what is the best way to do it?我应该在
ci.yml
文件中添加一行,最好的方法是什么?
In the ci.yml
file, adding the nltk.downloader
commandline after importing dependencies defined in requirements.txt
worked for me.在
ci.yml
文件中,在导入requirements.txt
中定义的依赖项后添加nltk.downloader
命令行对我有用。
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
python -m nltk.downloader punkt stopwords
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.