使用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
相关产品推荐
相关产品推荐

