Linux服务器报错解决The git executable must be specified in one of the following ways: - be included in

这篇具有很好参考价值的文章主要介绍了Linux服务器报错解决The git executable must be specified in one of the following ways: - be included in。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

在利用深度学习服务器,利用Xshell进入端口,想要运行深度学习项目时碰到了以下错误:

Traceback (most recent call last):
  File "/opt/conda/envs/[yolov5_SE]/lib/python3.9/site-packages/git/__init__.py", line 166, in <module>
    refresh()
  File "/opt/conda/envs/[yolov5_SE]/lib/python3.9/site-packages/git/__init__.py", line 153, in refresh
    if not Git.refresh(path=path):
  File "/opt/conda/envs/[yolov5_SE]/lib/python3.9/site-packages/git/cmd.py", line 391, in refresh
    raise ImportError(err)
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
The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/root/yolov5-master/yolov5-master/train.py", line 73, in <module>
    GIT_INFO = check_git_info()
  File "/opt/conda/envs/[yolov5_SE]/lib/python3.9/contextlib.py", line 79, in inner
    return func(*args, **kwds)
  File "/root/yolov5-master/yolov5-master/utils/general.py", line 370, in check_git_info
    import git
  File "/opt/conda/envs/[yolov5_SE]/lib/python3.9/site-packages/git/__init__.py", line 168, 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()

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

这个错误表明你的环境中存在与git可执行文件相关的问题。错误提示你需要通过以下方式之一指定git可执行文件的位置:

  1. 包含在你的PATH中
  2. 通过GIT_PYTHON_GIT_EXECUTABLE设置
  3. 通过git.refresh()显式设置

你可以通过以下方法解决这个问题:

  1. 确保git可执行文件在系统的PATH中。你可以在终端中运行 git --version 来检查git是否安装。如果没有安装,你需要先安装git。

  2. 将GIT_PYTHON_GIT_EXECUTABLE环境变量设置为git可执行文件的路径。

  3. 通过代码使用git.refresh()来显式设置git可执行文件的路径。

最终我通过输入以下命令即可完美解决。文章来源地址https://www.toymoban.com/news/detail-787988.html

export GIT_PYTHON_REFRESH=quiet

到了这里,关于Linux服务器报错解决The git executable must be specified in one of the following ways: - be included in的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包赞助服务器费用

相关文章

  • 【Linux】远程桌面连接服务器报错:未启用对服务器的远程访问......

    【Linux】远程桌面连接服务器报错:未启用对服务器的远程访问......

    🍁 博主简介   🏅云计算领域优质创作者   🏅华为云开发者社区专家博主   🏅阿里云开发者社区专家博主 💊 交流社区: 运维交流社区 欢迎大家的加入! 我们知道,我们日常通过vnc来远程管理linux图形界面,今天分享一工具Xrdp,它是一个开源工具,允许用户通过

    2024年02月04日
    浏览(14)
  • git push提交代码到服务器报remote: [session-xx] Access denie The requested URL returned error: 403

    git push提交代码到服务器报remote: [session-xx] Access denie The requested URL returned error: 403

    操作: 执行 git push -u origin master ,我想把commit的代码直接提交到远程的仓库,哪知道直接给我一个报错: remote: [session-xxx] Access denied fatal: unable to access \\\'https://gitee.com/xxx/xxx.git/\\\': The requested URL returned error: 403 原因: 这是账号不一致 可以通过查询一下当前用户: cat ~/.gitconfig

    2024年02月11日
    浏览(16)
  • git push或者git push -u origin “master“报错无法连接到服务器,导致不能push到码云

    git 不能推送到码云上 文件可以放在暂存区,但是只要输入git push -u origin \\\"master\\\"命令就会报错一下情况: 设置了错误的 http 代理导致的 Git 中的 http 代理配置可以通过  git config  命令进行设置和修改。如果不小心将错误的代理配置了全局 http 代理,那么在进行 Git 操作时就可

    2024年02月05日
    浏览(17)
  • git连接Gitee服务器时显示错误The authenticity of host ‘gitee.com (212.64.63.190)‘ can‘t be established.

    git连接Gitee服务器时显示错误The authenticity of host ‘gitee.com (212.64.63.190)‘ can‘t be established.

    我的sourcetree克隆时显示这是一个无效源路径,在查找资料之后发现可能是没有连接远程仓库,然后就有以下错误。求大佬帮忙!!!

    2024年02月16日
    浏览(9)
  • linux服务器部署jenkins+python+git部署讲解与git仓库的使用

    linux服务器部署jenkins+python+git部署讲解与git仓库的使用

    1.首先需要安装一下虚拟机:推荐使用 VMware 这个比较好用,如果不知道怎么安装可以根据下面的网站去看教程,很简单 【VMware 详细安装教程,亲测有效】-CSDN博客 2.安装好之后,可以使用 Xshell 去连接你得虚拟机,建议使用 Xshell 操作虚拟机,因为企业里面都是使用远程连接工

    2024年02月20日
    浏览(46)
  • python解决报错ImportError: Bad git executable.

    python解决报错ImportError: Bad git executable.

    在跑代码时出现了以下错误: Bad git executable. 按照上述路径,找到E:Anaconda3Libsite-packagesgitcmd 添加: 问题解决

    2024年02月11日
    浏览(14)
  • nginx服务器报错502 Bad Gateway的原因以及解决办法

    服务器报错nginx 502 Bad Gateway的原因以及解决办法_502 bad gateway nginx_主题模板站的博客-CSDN博客

    2024年02月13日
    浏览(13)
  • 服务器报错nginx 502 Bad Gateway的原因以及解决办法

    服务器报错nginx 502 Bad Gateway的原因以及解决办法

    网站页面出现502badgateway怎么办?今天我们来分析一下原因和解决办法。 nginx出现502多数是属于后端的问题,后期就是PHP的问题,在php服务当中,有两个参数非常的重要:max_requestst 和max_children;具体的原因必须要查看日志才可以弄明白! 1:FastCGI进程是否已经启动 ps aux|grep

    2023年04月20日
    浏览(12)
  • websocket链接断开服务器报错java.io.EOFException解决办法

    首先说一下报错原因,由于默认60s无消息交互就会关闭长连接,所以导致这个报错 解决方案其实也很简单,既然是长时间没有通信导致断开,其实保持通信就好,可以设置心跳时间来解决。 可以前端也可以后端,附上前端代码吧 //心跳检测 var heartCheck = {     timeout: 60000,//

    2024年02月08日
    浏览(9)
  • Navicat远程连接云服务器数据库的方法(含报错解决方法)

    Navicat远程连接云服务器数据库的方法(含报错解决方法)

      目    录  1.服务器控制台开启SSH服务  2.navicat远程连接云服务器数据库步骤: 3.navicat 操作演示 4.navicat远程连接常见错误报警     (图:001创建MySQL的ssh通道允许远程服务)     (首先登录云服务器官方提供的后台管理控制台,此处以腾讯云服务器为演示)  1.点击防火

    2024年02月05日
    浏览(9)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包