Pycharm 配置git报错:Can not Run Git:runnerw.exe:CreateProcess failed with error

本文介绍了PyCharm中配置Git时遇到的runnerw.exe错误,解决办法是确保正确设置Git的环境变量。通过CMD验证Git配置成功后,在PyCharm的Settings中指定Git可执行文件路径并测试。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 导致报错原因,是由于没有配置Git 环境变量。

对于git的安装完成之后,就需要对git配置环境变量,这个可以cmd来进行调用。

使用cmd来确定git的环境是否配置成功,进行输入git 如果弹出git相关信息,说明是配置成功了。

然后进行打开pycharm的后,进行点击菜单中file 菜单,弹出了下拉菜单选中为 settings 的选项。

进入到了settings的界面当中,进行点击 version control 的中的 git 的选项。

然后在path to git executable中进行浏览到安装的路径的git.exe 文件。

 

路径浏览器完成之后,进行点击了Test 即可。来进行测试一个是否配置成功了。

 

Traceback (most recent call last): File "D:\pycharm\yolov5\yolov5\train.py", line 100, in <module> GIT_INFO = check_git_info() ^^^^^^^^^^^^^^^^ File "C:\Users\fsy\.conda\envs\yolov5\Lib\contextlib.py", line 81, in inner return func(*args, **kwds) ^^^^^^^^^^^^^^^^^^^ File "D:\pycharm\yolov5\yolov5\utils\general.py", line 405, in check_git_info import git File "C:\Users\fsy\.conda\envs\yolov5\Lib\site-packages\git\__init__.py", line 298, in <module> raise ImportError("Failed to initialize: {0}".format(_exc)) from _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(<full-path-to-git-executable>) All git commands will error until this is rectified. This initial message 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|silent|none|n|0: for no message or exception - warn|w|warning|log|l|1: for a warning message (logging level CRITICAL, displayed by default) - error|e|exception|raise|r|2: for a raised exception Example: export GIT_PYTHON_REFRESH=quiet (yolov5) PS D:\pycharm\yolov5\yolov5> python train.py Traceback (most recent call last): File "C:\Users\fsy\.conda\envs\yolov5\Lib\site-packages\git\cmd.py", line 1262, in execute proc = safer_popen( ^^^^^^^^^^^^ File "C:\Users\fsy\.conda\envs\yolov5\Lib\site-packages\git\cmd.py", line 281, in _safer_popen_windows return Popen( ^^^^^^ File "C:\Users\fsy\.conda\envs\yolov5\Lib\subprocess.py", line 1026, in __init__ self._execute_child(args, executable, preexec_fn, close_fds, File "C:\Users\fsy\.conda\envs\yolov5\Lib\subprocess.py", line 1538, in _execute_child hp, ht, pid, tid = _winapi.CreateProcess(executable, args, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FileNotFoundError: [WinError 2] 系统找不到指定的文件。 The above exception was the direct cause of the following exception: Traceback (most recent call last): File "D:\pycharm\yolov5\yolov5\train.py", line 102, in <module> GIT_INFO = check_git_info() ^^^^^^^^^^^^^^^^ File "C:\Users\fsy\.conda\envs\yolov5\Lib\contextlib.py", line 81, in inner return func(*args, **kwds) ^^^^^^^^^^^^^^^^^^^ File "D:\pycharm\yolov5\yolov5\utils\general.py", line 410, in check_git_info commit = repo.head.commit.hexsha # i.e. '3134699c73af83aac2a481435550b968d5792c0d' ^^^^^^^^^^^^^^^^ File "C:\Users\fsy\.conda\envs\yolov5\Lib\site-packages\git\refs\symbolic.py", line 297, in _get_commit obj = self._get_object() ^^^^^^^^^^^^^^^^^^ File "C:\Users\fsy\.conda\envs\yolov5\Lib\site-packages\git\refs\symbolic.py", line 288, in _get_object return Object.new_from_sha(self.repo, hex_to_bin(self.dereference_recursive(self.repo, self.path))) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\fsy\.conda\envs\yolov5\Lib\site-packages\git\objects\base.py", line 149, in new_from_sha oinfo = repo.odb.info(sha1) ^^^^^^^^^^^^^^^^^^^ File "C:\Users\fsy\.conda\envs\yolov5\Lib\site-packages\git\db.py", line 41, in info hexsha, typename, size = self._git.get_object_header(bin_to_hex(binsha)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\fsy\.conda\envs\yolov5\Lib\site-packages\git\cmd.py", line 1678, in get_object_header cmd = self._get_persistent_cmd("cat_file_header", "cat_file", batch_check=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\fsy\.conda\envs\yolov5\Lib\site-packages\git\cmd.py", line 1654, in _get_persistent_cmd cmd = self._call_process(cmd_name, *args, **options) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\fsy\.conda\envs\yolov5\Lib\site-packages\git\cmd.py", line 1599, in _call_process return self.execute(call, **exec_kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\fsy\.conda\envs\yolov5\Lib\site-packages\git\cmd.py", line 1276, in execute raise GitCommandNotFound(redacted_command, err) from err git.exc.GitCommandNotFound: Cmd('git') not found due to: FileNotFoundError('[WinError 2] 系统找不到指定的文件。') cmdline: git cat-file --batch-check (yolov5) PS D:\pycharm\yolov5\yolov5>
最新发布
07-21
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值