gpt4 book ai didi

python - 导入错误 : No module named git after reformatting laptop

转载 作者:IT王子 更新时间:2023-10-29 00:34:51 25 4
gpt4 key购买 nike

我的笔记本电脑已经格式化并安装了新的操作系统,从那以后我得到这个错误:ImportError: 没有名为 git 的模块

这是指简单导入 git 的 python 代码。

我的笔记本格式化前git的位置:/usr/local/bin/git笔记本格式化后git的位置:/usr/bin/git

如何/更改我的 python 代码中的哪些内容以引用正确的路径?

最佳答案

git 模块与 git 命令行可执行文件不同。它们碰巧具有相同的名称并涵盖相关任务,但它们是不同的软件包。

我假设您的代码正在导入的git 模块是由GitPython project 提供的模块。 .您需要安装该项目,请参阅他们的 installation instructions :

# pip install gitpython

关于python - 导入错误 : No module named git after reformatting laptop,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28483253/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com