Python pipenv运行预提交--全部失败,原因是:发生意外错误:AttributeError:type object';挂钩';没有属性';创造

Python pipenv运行预提交--全部失败,原因是:发生意外错误:AttributeError:type object';挂钩';没有属性';创造,python,git,code-formatting,pipenv,pre-commit.com,Python,Git,Code Formatting,Pipenv,Pre Commit.com,在我的pre-commit-config.yaml文件中,我试图运行black,即python代码格式化程序 repos: - repo: https://github.com/python/black rev: stable hooks: - id: black language_version: python3.6 但是每当我尝试使用pipenv run pre-commit运行black时,所有的代码都会失败,并显示错误消息 An unexpect

在我的pre-commit-config.yaml文件中,我试图运行black,即python代码格式化程序

repos:
-   repo: https://github.com/python/black
    rev: stable
    hooks:
    - id: black
      language_version: python3.6
但是每当我尝试使用
pipenv run pre-commit运行black时,所有的
代码都会失败,并显示错误消息

An unexpected error has occurred: AttributeError: type object 'Hook' has no attribute 'create'
Check the log at some_path

当我转到某个路径时,我在那里找不到任何日志。我尝试不运行
pipenv run pre-commit--all
将黑色应用于我的代码,但是当我尝试
git commit
任何新文件时,错误仍然出现。有什么办法可以解决这个问题吗?

我在使用python 3.6.0时遇到了这个问题,我已经升级到python 3.6.9,这个错误不再存在。

我在使用python 3.6.0时遇到了这个问题,我已经升级到python 3.6.9,这个错误不再存在。

我没有尝试升级我的python,但我尝试了下面的步骤,它对我有效

1. pipenv shell
2. pip install black
3. black name_of_the_directory_you_want_to_format

我没有尝试升级我的python,但我尝试了以下步骤,它对我有效

1. pipenv shell
2. pip install black
3. black name_of_the_directory_you_want_to_format

这是Python3.6.0(这个补丁版本)的一个bug,并且在版本2.0.0和2.1.0之间预提交

这在2.1.1中得到了修正:



免责声明:我是pre-commit

的作者,这是Python3.6.0(这个补丁版本)和pre-commit在版本2.0.0和2.1.0之间的一个bug

这在2.1.1中得到了修正:



免责声明:我是pre-commit的作者

我也有同样的问题,我目前正在努力理解这个问题。问题发生后,您是否取得了任何成功?我也有同样的问题,我目前正在努力了解问题。自从问题发生后,你成功了吗?