Win10+python3.6+git运行出现问题

mac2024-07-11  7

问题描述

这个问题有点迷,基本就是因为python无法调用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 During handling of the above exception, another exception occurred:

解决方案

很简单。。。 在小黑窗中输入下面的指令即可:

set GIT_PYTHON_GIT_EXECUTABLE=C:\Program Files\Git\cmd\git.exe

应该就是手动设置环境变量,可以使得python调用git。

总结

这个写的很匆忙,该吃饭了。。。。

最新回复(0)