不能按照蟒蛇git的教程
问题描述:
最近我安装的python-git的包,并试图按照教程上通过以下链接的时候,我发现某些方法缺少...不能按照蟒蛇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,所以它取决于你的发行版)。
我在看教程的过时版本吗? – deostroll 2012-07-07 18:12:39