美文网首页
python3 执行出现引用文件错误问题

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

作者: _蓝星 | 来源:发表于2020-10-10 17:29 被阅读0次

错误样式

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 执行出现引用文件错误问题

      本文链接:https://www.haomeiwen.com/subject/absjpktx.html