当我尝试在我的 jupyter 笔记本中安装 pandas 分析时,遇到错误如下
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.
scikit-learn 1.5.1 requires joblib>=1.2.0, but you have joblib 1.1.1 which is
incompatible.
现在,当我尝试升级 joblib 的版本时,我会遇到新的错误:
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.
pandas-profiling 3.2.0 requires joblib~=1.1.0, but you have joblib 1.4.2 which is
incompatible.
再次升级不平衡学习和 scikit-learn 会给我同样的不兼容错误。
如何解决此错误并正确安装 pandas-profiling?
如果您的环境中同时需要 scikit-learn 和 pandas-profiling,那么要解决两个库之间的冲突,您可以使用一条语句安装它们:
pip install scikit-learn pandas-profiling
上面的语句自动采用两个库的依赖项不存在冲突的版本。但请记住在运行上述命令之前卸载这两个库。
或者(我已经测试过)你可以使用以下命令安装 3.6.6 版本的 pandas-profiling:
pip install pandas-profiling==3.6.6
在这种情况下,您不需要卸载 scikit-learn,因为上述版本的 pandas-profiling 也采用 joblib 版本 1.4.2。所以这样安装不会有任何冲突。