【问题标题】:Cannot find pylint in git actions在 git 操作中找不到 pylint
【发布时间】:2021-02-11 19:17:57
【问题描述】:

尝试在我在 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 install 上收到此消息时,我尝试将其添加到我的 PATH 中

WARNING: The scripts epylint, pylint, pyreverse and symilar are installed in '/home/runner/.local/bin' which is not on PATH.

但这并没有解决问题。

【问题讨论】:

  • 你在 requirements.txt 中有 pylint 吗?
  • 是的 pylint==2.6.0 并且它被安装在 pip install 的日志中
  • 这是一个错字:export PATH=/home/runner/.local/bin/$PATH——应该是export PATH=/home/runner/.local/bin/:$PATH(注意:

标签: python git github github-actions pylint


【解决方案1】:

似乎没有正确配置python。您需要在工作流程的开头添加actions/setup-python 步骤才能正确设置。尝试删除该行

- 运行: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/

这应该可以解决问题。

【讨论】:

    猜你喜欢
    • 2022-12-15
    • 2012-11-12
    • 2017-09-02
    • 2018-03-02
    • 2018-06-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多