Briefcase requires git, but it is not installed (or is not on your PATH)

文章描述了一个使用Python时遇到的Git相关问题,即已经安装了Git但仍然在执行briefcasenew和importgit时收到错误。解决方案是设置环境变量GIT_PYTHON_GIT_EXECUTABLE,而非添加到PATH。错误的具体原因是Git可执行文件未被正确识别。
摘要由CSDN通过智能技术生成

错误:已安装git并配置路径但执行briefcase new时报错如下:

Briefcase requires git, but it is not installed (or is not on your PATH)

表现:在python中输入import git会报错 ImportError: Bad git executable.

具体报错如下:

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

解决灵感来自ImportError: Bad git executable错误的解决方案_KI4EVER的博客-CSDN博客

解决方案:不用配置path,配置GIT_PYTHON_GIT_EXECUTABLE即可。如图

 错误原因:未知

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值