当使用subprocess.call("git sparse-checkout")执行git命令时,它返回一个错误,指出git命令不存在:
git: 'sparse-checkout' is not a git command. See 'git --help'.但是,当在终端中运行相同的命令时,我可以使用sparse-checkout而不会出现任何问题。
我还尝试使用以下几种方法:
subprocess.call(['git', 'sparse-checkout'])
subprocess.call("git sparse-checkout", shell=True)
os.system("git sparse-checkout")所有这些都返回相同的结果。
我在RHEL 6.6上使用git 2.26.2和Python 3.2
发布于 2020-07-31 01:11:07
你得到的关于'sparce-checkout' is not a git command的错误指向脚本正在初始化的git版本不是>= git 2.26。
这看起来像是git中一个相对较新的命令。我会做两件事:
”)中看到的内容
的完整路径
https://stackoverflow.com/questions/63177599
复制相似问题