【发布时间】:2020-03-13 07:32:48
【问题描述】:
我在我的系统上安装了 Pyton 3.6.8。
python3 --version //-> Python 3.6.8
python3.6 --version //-> Python 3.6.8
我的 pre-commit-config.yaml 是:
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.4.0
- repo: https://gitlab.com/pycqa/flake8
rev: 3.7.9
hooks:
- id: flake8
language_version: python3.6
我为我的项目安装了预提交挂钩。 每次我想对 git 提交一些更改时,预提交都在运行 flake8 错误:
TYP005 NamedTuple does not support defaults in 3.6.0
这适用于 Python 3.6.0,因为 Python 3.6.1+ 引入并允许使用此功能。 https://docs.python.org/3.6/library/typing.html#typing.NamedTuple
如何配置 flake8 以与 Python 3.6.8 一起运行?
编辑 当我运行 flake8 file.rb 时,我没有收到错误消息 TYP005。
python3 -m pip install flake
flake --version //-> 3.7.9 (the same version as in the pre-commit script file)
【问题讨论】:
-
language_version: python3.6.8?或者那是一个可执行文件?我假设您使用的是pre-commit.com。你还有其他 flake8 配置吗?如果您通过预提交以外的方式运行它会发生什么? -
是的,我使用 pre-commit.com。如果我使用 python3.6.8 我仍然会得到同样的错误。我没有更多的 flake8 配置文件。
-
如果直接运行 flake8 会怎样?也许你应该有其他配置。
-
当我运行 flake8 file.rb 时,我没有收到此错误消息。安装者; python3 -m pip 安装 flake8。此外 flake8 --version 也是 3.7.9
-
请edit这个信息进入问题。
标签: python-3.6 flake8 pre-commit pre-commit.com