如何解决在git action中找不到pylint
试图在我的github构建中运行pylint动作,但它说找不到pylint。
代码
linting:
name: PyLint
runs-on: ubuntu-latest
needs: install
steps:
- uses: actions/checkout@v2
- run: pip3 install -U pip setuptools
- run: pip3 install -U -r requirements.txt
- run: export PATH=/home/runner/.local/bin/$PATH
- run: pylint --rcfile=.pylintrc src/
错误
Run pylint --rcfile=.pylintrc src/
/home/runner/work/_temp/44ccfc48-998a-405a-b25a-20b24f532ea1.sh: line 1: pylint: command not found
Error: Process completed with exit code 127.
当我在pip安装中收到此消息时,我尝试将其添加到PATH
WARNING: The scripts epylint,pylint,pyreverse and symilar are installed in '/home/runner/.local/bin' which is not on PATH.
但这对问题没有帮助。
解决方法
似乎python配置不正确。您需要在工作流程的开始添加actions/setup-python
步骤,以正确进行设置。尝试删除该行
- run: export PATH=/home/runner/.local/bin/$PATH`
并添加
- uses: actions/setup-python@v2
在致电pip
linting:
name: PyLint
runs-on: ubuntu-latest
needs: install
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- run: pip3 install -U pip setuptools
- run: pip3 install -U -r requirements.txt
- run: pylint --rcfile=.pylintrc src/
这应该可以解决问题。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。