小编Mad*_*ili的帖子

在python中找不到git可执行文件

我试图用访问密钥克隆一个 git 存储库,但是当我尝试运行它时,它抛出一个异常,说找不到 git 可执行文件。但是我已经安装了 git 并且 in_it.py 显示了正确的路径 "C:\Program Files\Git\bin" 另外我已经安装了 gitpython 以在 python 中使用该库

这是我的代码...

import git

git.Git("D:/madhav/myrep/").clone("@github.com:myrepo/scripts")
Run Code Online (Sandbox Code Playgroud)

========== 并抛出以下异常 ================

Traceback (most recent call last):   File
"C:\Users\1096506\Desktop\gitclone.py", line 1, in <module>
    from git import Repo   File "C:\Users\1096506\AppData\Local\Programs\Python\Python36-32\lib\site-packages\git\__init__.py",
line 84, in <module>
    refresh()   File "C:\Users\1096506\AppData\Local\Programs\Python\Python36-32\lib\site-packages\git\__init__.py",
line 73, in refresh
    if not Git.refresh(path=path):   File "C:\Users\1096506\AppData\Local\Programs\Python\Python36-32\lib\site-packages\git\cmd.py",
line 293, in refresh
    raise ImportError(err) ImportError: Bad git executable. The git executable must be specified in one of the following ways:
     - be …
Run Code Online (Sandbox Code Playgroud)

python git gitpython

3
推荐指数
3
解决办法
2万
查看次数

标签 统计

git ×1

gitpython ×1

python ×1