| 
                            
                                  Python安装pygit2失败报错输出这是最后一部分输出 
  In file included from src/blob.c:30:0:src/blob.h:33:10: fatal error: git2.h: 没有那个文件或目录
 #include <git2.h>
 ^~~~~~~~
 compilation terminated.
 error: command 'gcc' failed with exit status 1
 ----------------------------------------
 ERROR: Failed building wheel for pygit2
 Failed to build pygit2
 ERROR: Could not build wheels for pygit2 which use PEP 517 and cannot be installed directly
 原因我是因为Python的版本太低了。 现在是3.6,我更新到3.9后就好了。更新命令 python调用gitpython,遇到gitpython库不支持的复杂命令或个性命令时的解决需求在执行git log命令时,git中支持诸如: 
git log --pretty=format:"%H,%an,%cd" “D:\your_target_file_path”> D:/test/log_data/log.csv 但是当我们希望通过python批量拉取自定义repo的时候 我们发现gitpython时,并不支持这类非常规命令(如果有知道如何使用非常规命令的小伙伴在评论区指出) 这个时候我们可以通过python+cmd的思路来解决这个问题 
 
 Git_Log.py 
	
		
			| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | import subprocess   # microsoftdocs/azure-docs-sdk-python RepoFullName = input(str("请输入Repo:")) RepoFullName_split = RepoFullName.split("/") repo_file = RepoFullName_split[0]+"_"+RepoFullName_split[1] cmd1 = "cd \\" cmd2 = "D:" cmd3 = "cd test" cmd5 = "cd {}".format(repo_file) cmd6 = "git init" cmd8 = "git checkout -b baymax_branch" cmd14 = """git log --pretty=format:"%H,%an,%cd" > D:/test/log_data/log_{}.csv""".format(repo_file) cmd = cmd1 + " && " + cmd2 + " && " + cmd3 + " && " + \       cmd5 + " && " + cmd6 + " && " + cmd8 + " && " + cmd14   subprocess.Popen(cmd, shell=True) |  
 |