pip包冲突-两个包依赖同一包的不同版本

pip包冲突-两个包依赖同一包的不同版本

问题:rich 和metrics 依赖pygments的不同版本

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
metrics 0.3.3 requires Pygments==2.2.0, but you have pygments 2.17.2 which is incompatible.

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
rich 13.7.1 requires pygments<3.0.0,>=2.13.0, but you have pygments 2.2.0 which is incompatible.

情况一:两个包依赖的pygments版本有交集

解决思路:如果有交集,直接重新安装交集中的pygments版本

pip install pygments==xx.xx

情况二:两个包依赖的pygments版本没有交集

解决思路:如果没有交集,为了安全,将后安装的包版本降低或升高。一般来说后安装的包都是最新的包,可以适当降低版本以匹配依赖。

我这里是先安装了rich ,后安装metrics 出现了依赖包pygments的冲突。

  1. pip查看metrics可安装包版本
pip index versions metrics
> pip index versions metrics
WARNING: pip index is currently an experimental command. It may be removed/changed in a future release without prior warning.
metrics (0.3.3)
Available versions: 0.3.3, 0.3.2, 0.3.1, 0.3.0, 0.2.8, 0.2.7, 0.2.6, 0.2.5, 0.2.4, 0.2.3, 0.2.2, 0.2.1, 0.2.0
  INSTALLED: 0.3.3
  LATEST:    0.3.3

  1. 降低metrics包的版本
pip isntall  metrics==0.2.5

考虑到是metrics后安装,而且版本是最新的版本,把metircs版本降低到0.2.5,这样就可以三个包共存。

具体选哪个版本是随缘选的。

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值