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

使用Poetry安装matplotlib与seaborn时版本解析失败求助

解决Poetry同时安装matplotlib和seaborn的版本冲突问题

方案1:升级seaborn到兼容matplotlib 3.6.1+的版本

seaborn 0.13.0及以上版本已经修复了这个依赖限制,直接执行命令:

poetry add matplotlib seaborn@^0.13.0

Poetry会自动匹配兼容的matplotlib版本(3.6.1到4.0.0之间的版本),顺利完成安装。

方案2:降级matplotlib到seaborn 0.12.x支持的版本

如果必须使用seaborn 0.12.x系列,指定matplotlib为3.6.0及以下版本即可,执行命令:

poetry add matplotlib@3.6.0 seaborn@^0.12.1

这个版本组合完全符合seaborn 0.12.1的依赖要求,不会出现冲突。

方案3:手动修改依赖文件后重新安装

直接编辑项目根目录下的pyproject.toml,添加兼容的依赖版本对(二选一即可):

[tool.poetry.dependencies]
# 组合1:升级后的版本
matplotlib = "^3.7.0"
seaborn = "^0.13.0"

# 组合2:降级后的版本
# matplotlib = "3.6.0"
# seaborn = "^0.12.1"

修改完成后执行:

poetry install

内容的提问来源于stack exchange,提问作者winter

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.15 16:21:09