gpt4 book ai didi

python - 无法遵循 python git 教程

转载 作者:太空狗 更新时间:2023-10-29 14:39:56 24 4
gpt4 key购买 nike

我最近安装了 python-git 包,当我尝试按照以下链接中的教程进行操作时,我发现缺少某些方法...

http://packages.python.org/GitPython/0.3.2/tutorial.html#tutorial-label

这是我的解释器的结果:

>>> from git import *
>>> repo = Repo.init('/home/deostroll/scripts/synchost')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: type object 'Repo' has no attribute 'init'
>>> repo = Repo('/home/deostroll/scripts/synchost')
>>> repo.is_dirty()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'bool' object is not callable
>>>

最佳答案

这些命令对我有用,所以我同意另一个答案,即您可能使用的是过时的版本。如果你在 linux 上并且有 PIP ,已安装,您可以在命令行上执行以下操作:

pip install --upgrade GitPython

升级到最新版本。 (旁注:对于 Fedora 上的我来说,该命令实际上是 pip-python,因此它取决于您的发行版)。

关于python - 无法遵循 python git 教程,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11377444/

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