我一直在尝试使用 GitHub 工作流程构建我的项目并将其上传到 PyPI,当此构建部分发生错误时:
这是错误本身:
File "/home/runner/work/crossword_puzzle/crossword_puzzle/crossword_puzzle/main.py", line 15, in <module>
from babel import Locale, UnknownLocaleError
ModuleNotFoundError: No module named 'babel'
每当我提交并且 GitHub 工作流程运行它来检查代码时,tox 都会发生同样的问题。直接在我的电脑上使用 tox 时也会发生同样的情况。
此错误以前没有发生过,并且由于我没有更改任何会特别影响此错误的重大内容,所以我不知道该怎么做。
有什么建议或修复吗?
一个偶然的机会,我发现了这个问题。
在我的主要
__init__.py
中,我像这样定义了版本:
__version__ = "1.2.81"
在 setup.py 中我将其导入以在 setup 函数中使用
from crossword_puzzle import __version__
删除此行后,tox 不再引发错误。