経緯
大学の授業で「Pythonではじめる機械学習;scikit-learnで学ぶ特徴量エンジニアリングと機械学習の基礎」を使うので環境構築してたらこんなエラーが出た
ImportError: cannot import name 'set_matplotlib_formats' from 'IPython.display'
set_matplotlib_formats
が見つからないとのこと
たしかにIPython.display
にはなかった
環境
関係ありそうなのはこの辺り
ipython==9.0.2
matplotlib==3.10.1
matplotlib-inline==0.1.7
原因
どうやらset_matplotlib_formats
の場所が移動したらしい
importの部分をこのように変更すると解決できる
from matplotlib_inline.backend_inline import set_matplotlib_formats