[英]'git' is not recognized as an internal or external command, operable program or batch file even after adding to PATH
I am a beginner in python.我是python的初学者。 I have written the following python code:
我编写了以下python代码:
import subprocess
PIPE = subprocess.PIPE
process = subprocess.Popen(['git', 'status'], stdout=PIPE, stderr=PIPE, cwd='my\git-repo\path',shell=True)
stdout_str, stderr_str = process.communicate()
print (stdout_str)
print (stderr_str)
Upon execution of the python script, I get the following output:执行 python 脚本后,我得到以下输出:
b''
b'"git" is not recognized as an internal or external command,\r\noperable program or batch file.\r\n'
I have added '..../git/bin' to my PATH variable, and since then git commands run fine in cmd.exe.我已将 '..../git/bin' 添加到我的 PATH 变量中,此后 git 命令在 cmd.exe 中运行良好。 Since 'shell=True', I thought this would run too.
由于'shell=True',我认为这也会运行。
I can't seem to get a hold of the issue.我似乎无法抓住这个问题。 Help appreciated.
帮助表示赞赏。
Because git add*
is not correct.因为
git add*
不正确。 git add *
is, however.但是,
git add *
是。
The issue was due to GIT PATH issues.该问题是由于 GIT PATH 问题造成的。 Once, I updated the PATH properly in Windows Environment Variables and restarted CMD, I didn't face this issue.
有一次,我在 Windows 环境变量中正确更新了 PATH 并重新启动了 CMD,我没有遇到这个问题。 Further info can be found at 'git' is not recognized as an internal or external command
可以在“git”不被识别为内部或外部命令中找到更多信息
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.