python3 執(zhí)行出現(xiàn)引用文件錯誤問題

錯誤樣式

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

錯誤原因是 gitpython 依賴的文件更新后,本地依賴還沒有更新。查詢獲取的信息大概是gitdb2、gitdb 中有文件刪除導(dǎo)致錯誤。
執(zhí)行如下更新命令即可修復(fù)

pip install gitpython --upgrade

以下是查找過程中看到的另一種解決方案,具體如下:
通過安裝pipdeptree來查看依賴關(guān)系
執(zhí)行

pipdeptree | grep git

查看結(jié)果

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

可以通過卸載重裝,重裝并強(qiáng)制制定依賴版本

$ pip uninstall gitdb2
$ pip install gitdb2==4.0.2

通過頂部命令即可快速修復(fù)版本依賴錯誤的問題

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容