当前位置:   article > 正文

解决ImportError: Bad git executable._import git报错

import git报错
ImportError: Bad git executable.
The git executable must be specified in one of the following ways:
    - be included in your $PATH
    - be set via $GIT_PYTHON_GIT_EXECUTABLE
    - explicitly set via git.refresh()

All git commands will error until this is rectified.

This initial warning can be silenced or aggravated in the future by setting the
$GIT_PYTHON_REFRESH environment variable. Use one of the following values:
    - quiet|q|silence|s|none|n|0: for no warning or exception
    - warn|w|warning|1: for a printed warning
    - error|e|raise|r|2: for a raised exception

Example:
    export GIT_PYTHON_REFRESH=quiet
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16

解决方法:
1、添加环境变量
2、激活git
3、os.environ[“GIT_PYTHON_REFRESH”] = “quiet”

[注释] 3 表示在报错的链接处,点进去然后在 import git 或 from git import xxx前面加一行。

https://jingyan.baidu.com/article/15622f24a5b5cdbdfcbea5d5.html
https://stackoverflow.com/questions/48399498/git-executable-not-found-in-python

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Monodyee/article/detail/621183
推荐阅读
相关标签
  

闽ICP备14008679号