简体   繁体   English

即使在添加到 PATH 后,“git”也不会被识别为内部或外部命令、可运行的程序或批处理文件

[英]'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.

相关问题 'c:\Program' 不是内部或外部命令,也不是可运行的程序或批处理文件 - 'c:\Program' is not recognized as an internal or external command, operable program or batch file 'command' 不是内部或外部命令,也不是可运行的程序 或批处理文件 - 'command' is not recognized as an internal or external command, operable program or batch file pipenv-无法将“ pew”识别为内部或外部命令,可操作程序或批处理文件 - pipenv - 'pew' is not recognized as an internal or external command, operable program or batch file 'kedro' 不是内部或外部命令,也不是可运行的程序或批处理文件 - 'kedro' is not recognized as an internal or external command, operable program or batch file conda 不是内部或外部命令,也不是可运行的程序或批处理文件 - conda is not recognized as an internal or external command, operable program or batch file 'import' 不是内部或外部命令、可运行程序或批处理文件 - 'import' is not recognized as an internal or external command, operable program or batch file 'pylint' 不是内部或外部命令、可运行程序或批处理文件 - 'pylint' is not recognized as an internal or external command, operable program or batch file 'pip3' 不是内部或外部命令,也不是可运行的程序或批处理文件 - 'pip3' is not recognized as an internal or external command, operable program or batch file 'pip'不被识别为内部或外部命令,可操作程序或批处理文件 - 'pip' is not recognized as an internal or external command, operable program or batch file 不是内部或外部命令、可运行的程序或批处理文件 - is not recognized as an internal or external command, operable program or batch file
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM