首页 > 解决方案 > 尝试运行 flake8 的 gitlab ci 返回错误:pipenv run flake8

问题描述

尝试 gitlab ci 集成,并在尝试运行 flake8 check 时遇到此问题

配置

image: "python:3.9"

before_script:
  - python --version
  - pip install pipenv
  - pipenv install

stages:
  - Static Analysis

flake8:
  stage: Static Analysis
  script:
    - pipenv run flake8 --max-line-length=120 sample/*.py
$ pipenv run flake8 --max-line-length=120 sample/*.py
Error: the command flake8 could not be found within PATH or Pipfile's [scripts].

标签: pythongitlab

解决方案


通过使用解决

pipenv install --deploy --dev

最后

image: "python:3.9"

before_script:
  - python --version
  - pip install pipenv
  - pipenv install --deploy --dev

stages:
  - Static Analysis

flake8:
  stage: Static Analysis
  script:
    - pipenv run flake8 --max-line-length=120 sample/*.py


推荐阅读