机器学习IPython could not be loaded问题

在使用shap.initjs()时,遇到IPython could not be loaded!问题?
提示AssertionError: IPython must be installed to use initjs()! Run pip install ipython and then restart shap.
ipython已经安装,为何不能使用呢?

img

img

img

img

该回答引用GPTᴼᴾᴱᴺᴬᴵ
可能是由于ipython版本与jupyter版本不兼容导致的问题。可以尝试升级ipython版本,如果还有问题,可以尝试降低ipython版本。

可以使用以下命令升级ipython:

pip install --upgrade ipython

如果还有问题,可以尝试降低ipython版本,例如:

pip install ipython==7.16.1

如果问题仍然存在,可以尝试重启jupyter,或者重新安装jupyter。