You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用GRC协议连接AWS CodeCommit执行git fetch时遇依赖错误

解决Git连接AWS CodeCommit时git fetch报错(jmespath依赖缺失)

错误详情

执行git fetch时触发以下报错:

git fetch
Traceback (most recent call last):
  File "/home/meh/.local/bin/git-remote-codecommit", line 6, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3095, in <module>
    @_call_aside
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3079, in _call_aside
    f(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3108, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 570, in _build_master
    ws.require(__requires__)
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 888, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 774, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'jmespath<2.0.0,>=0.7.1' distribution was not found and is required by botocore

问题原因

git-remote-codecommit依赖的botocore组件需要版本范围在>=0.7.1且<2.0.0的jmespath包,但当前Python环境中未安装该包,或版本不符合要求。

解决方案

方法1:直接安装符合要求的jmespath版本

使用对应Python版本的pip(这里是Python3.6)安装指定范围的jmespath:

python3.6 -m pip install "jmespath>=0.7.1,<2.0.0"

方法2:重装相关依赖解决冲突

如果方法1无效,可能存在依赖缓存或冲突,可彻底卸载后重装:

  1. 卸载相关包:
python3.6 -m pip uninstall -y git-remote-codecommit botocore jmespath
  1. 重新安装git-remote-codecommit(会自动拉取所有兼容的依赖):
python3.6 -m pip install git-remote-codecommit

验证修复

执行git fetch测试是否正常,或通过以下命令确认jmespath版本符合要求:

python3.6 -m pip show jmespath

输出中Version字段需在0.7.1到2.0.0之间。

内容的提问来源于stack exchange,提问作者Im-Kirk-Dougla-Cus

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.07 22:25:23