【问题标题】:trying gitlab ci running flake8 returns error: pipenv run flake8尝试运行 flake8 的 gitlab ci 返回错误:pipenv run flake8
【发布时间】:2021-04-04 12:57:18
【问题描述】:

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

ci 配置

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].

【问题讨论】:

  • 你必须安装flake8
  • 但是 pipenv install 应该安装 flake8,对吧?
  • 仅当配置为这样做时。
  • @KlausD。你能详细说明一下,如何配置它来做到这一点
  • 告诉我们你的Pipfile

标签: python gitlab


【解决方案1】:

通过使用解决

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-01-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-01-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多