python3 执行出现引用文件错误问题

错误样式

from gitdb.utils.compat import (
ModuleNotFoundError: No module named 'gitdb.utils.compat'

错误原因是 gitpython 依赖的文件更新后,本地依赖还没有更新。查询获取的信息大概是gitdb2、gitdb 中有文件删除导致错误。
执行如下更新命令即可修复

pip install gitpython --upgrade

以下是查找过程中看到的另一种解决方案,具体如下:
通过安装pipdeptree来查看依赖关系
执行

pipdeptree | grep git

查看结果

 ~ % pipdeptree | grep git
  - gitdb2 [required: >=2.0.0, installed: 4.0.2]
    - gitdb [required: >=4.0.1, installed: 4.0.5]

可以通过卸载重装,重装并强制制定依赖版本

$ pip uninstall gitdb2
$ pip install gitdb2==4.0.2

通过顶部命令即可快速修复版本依赖错误的问题

你可能感兴趣的:(python3 执行出现引用文件错误问题)