zoukankan      html  css  js  c++  java
  • python调用git出错

    #报错信息
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:Python27libsite-packagesgit\__init__.py", line 85, in <module>
        raise ImportError('Failed to initialize: {0}'.format(exc))
    ImportError: Failed to initialize: 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
    
    #出错原因:git环境变量设置问题
    #简便解决办法:在导入包的上方增加以下代码
    import os
    os.environ["GIT_PYTHON_REFRESH"] = "quiet"
    
  • 相关阅读:
    320 Generalized Abbreviation
    319. Bulb Switcher
    三条用人原则
    Go 编码问题的解决方案
    C# MVC js 跨域
    apidoc接口文档的快速生成
    go语言学习
    C#系统之垃圾回收
    WCF项目启动时错误处理
    XML之XPath
  • 原文地址:https://www.cnblogs.com/lelezuimei/p/14317730.html
Copyright © 2011-2022 走看看